Friday, November 12, 1993 Announcement: Instructor will be out of town next week. Classes to be taught by Prof. Wei Zhao ------------------------------------------------------------------------------- Disk Scheduling (Chapter 9) ------------------------------------------------------------------------------- Disk service time = seek time + latency time + transfer time seek time: moving the head to the appropriate cylinder latency time: waiting until the head is at the right block transfer time: data transfer (read or write) Seek time: can be reduced with a disk scheduling algorithm (incorporates head movement strategy) (to come) Latency time: function of disk rotation speed so can't be reduced Transfer time: varies with amount of data being transferred --- Disk scheduling algorithms specify where the head will be moved and which request will be serviced. Assume that the disk queue is often nonempty so we have some lattitude in terms of what request to pick to service next --- FCFS, SSTF, SCAN, C-SCAN, LOOK ------------------------------------------------------------------------------- First Come First Serve (FCFS) - requests serviced in order of arrival - easy to implement - not necessarily the best average seek time --- requests (tracks): 46 110 47 111 14 120 25, start at 50 What is total head movement? 46 110 47 111 14 120 25 4 64 63 64 97 106 95 = 493 ------------------------------------------------------------------------------- Shortest Seek Time First (SSTF) - Select request with the minimum seek time from the current head position --- Given above example, starting at 50 46 47 25 14 110 111 114 4 1 22 11 96 1 3 = 138 --- - Better than FCFS - Not optimal Consider starting at 50 with 14 37 53 65 92 94 SSTF 53 65 92 94 37 14 3 12 27 2 57 23 = 124 compared with the following sequence: 53 37 14 65 92 94 3 16 23 51 27 2 = 122 --- - Does not prevent starvation (e.g., new jobs arriving with better local minima) ------------------------------------------------------------------------------- Scan algorithm (elevator algorithm) - start at one end of disk and move to other end, then reverse --- Assume at 50 and heading towards top (say that is at 120) 110 111 114 (120) 47 46 25 14 60 1 3 6 73 1 21 11 = 176 --- - no starvation problem - but the amount of time you have to wait is position dependent as is variance (arrive just before head arrives, quick; arrive just after it left, slow) - modify Span for more unform wait time (C-Scan) ------------------------------------------------------------------------------- Circular Scan (C-Scan) - head always goes in same direction - when reach end of disk, return to start without handling any requests - as if the disk were circular (modulo arithmetic) - with start of 50 and if direction of travel is upward, above example is 110 111 114 (120) (0) 14 25 46 47 - no starvation problem - uniform average wait time ------------------------------------------------------------------------------- Look and C-Look as in Span and C-Span but don't keep going out to very end of disk, just to last request before reversing -------------------------------------------------------------------------------