Note: You MUST show your reasoning or calculation in order to get the points. 1. (10%) Consider the following statements regarding page replacement algorithms: (1) Optimal page replacement algorithm considers reference string in the future, while LRU (Least Recently Used) algorithm considers reference string in the past. (2) NRU (Not Recently Used) uses one bit to record the page access history, while LRU uses many bits in a couter to record the history. (3) If pages are referenced after the last clock tick, all of NRU, FIFO, Second Chance, Clock, and Aging algorithms can not tell the ordering of these references. (4) Referenced bit and Modified bit are not enough to implement the LRU. How many statements are incorrect? Also give your explanation for each statement no matter it is correct or incorrect. (a) none 2. (b) one (c) two (d) three or more. (10%) Consider the following producer and consumer implemented by semaphores: semaphore mutex = 1; semaphore empty = N; semaphore full = 0; void producer(void) { int item; while (TRUE) { produce_item(&item); down(&mutex); down(&empty); enter_item(item): up(&mutex); up(&full); } } void consumer(void) { int item; while (TRUE) { down(&mutex); down(&full); remove_item(&item); up(&mutex); up(&empty); consume_item(item); } } You are asked to check if the deadlock will occur. If it will, we use the notation (X, Y, Z) where X represents when the deadlock occurs, Y represents which semaphore producer sleeps on, and Z represents which semaphore consumer sleeps on. Consider the following combinations: (1) (buffer empty, mutex, full) (2) (buffer full, empty, mutex) (3) (buffer empty, empty, mutex) (4) (buffer full, mutex, full) How many combinations are correct? Also give a step-by-step reasoning. (a) none (i.e. no deadlock) (b) one 3. (c) two (d) three or four. (10%) Suppose there are 6 copies of tape drives, 3 copies of plotters, 4 copies of printers, 2 copies of CD ROM drives. The resouce allocation state is shown as the following tables: process tape drives plotters printers CD ROM drives -------------------------------------------------------------------------------------A 3 0 1 1 B 0 1 0 0 C 1 1 1 0 D 1 1 0 1 E 0 0 0 0 -------------------------------------------------------------------------------------Resources assigned process tape drives plotters printers CD ROM drives -------------------------------------------------------------------------------------A 1 1 0 0 B 0 1 1 2 C 3 1 0 0 D 0 0 1 0 E 2 1 1 0 -------------------------------------------------------------------------------------Resources still needeed Now, if we grant process A another tape driver, the system enters X state, If, instead, we grant process B a printer, the system enters Y state. What is (X, Y)? Explain step by step. (a) (safe, safe) 4. (b) (safe, unsafe) (c) (unsafe, safe)(d) (unsafe, unsafe). (10%) We now compare the speeds of memory-mapped I/O and RS-232 I/O. Suppose that a monochrome display has a screen with 2000 characters and a 4 KB video RAM, memory copying rate is 500 ns per byte, and RS-232 interface has a capacity of 9600 bps. To send a character, RS-232 driver has to send 10 bits, i.e. 2 extra bits are sent. If the memory-mapped terminal dirver takes X ms to load the screen image to the video RAM and the RS-232 terminal driver takes Y ms, including the blocking time in waiting for RS-232 interrupts, to finish transferring the same screen image to the terminal, what is Y/X, approximately? Show your calculation. (a) 256 5. (b) 512 (c) 1024 (d) 2048 (10%) The following “numbers” are the assumed typical times for various computer operations. Now consider yourself as a system designer and asked to judge whether these values are realistic for modern computer systems. (1) Clock tick time: 20 ms (2) Quantum: 500 ms (3) Memory copy time per byte: 500 μs (4) Disk arm seek time per cylinder: 6 ms (5) Disk rotation time per round: 100 ms (6) Disk block transfer time: 5 ms (7) Transmission one byte on Ethernet: 100 μs How many of these values are NOT realistic? If some of them are not realistic, explain your answers and give reasonable values for them. (a) one (b) two (c) three (d) four or more.