C-SCAN  Provides a more uniform wait time than SCAN  The head moves from one end of the disk to the other, servicing requests as it goes  When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip  Treats the cylinders as a circular list that wraps around from the last cylinder to the first one Operating System Concepts with Java – 8th Edition 12.14 Silberschatz, Galvin and Gagne ©2009
View full slide show




C-SCAN  Provides a more uniform wait time than SCAN  The head moves from one end of the disk to the other, servicing requests as it goes  When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip  Treats the cylinders as a circular list that wraps around from the last cylinder to the first one  Total number of cylinders? Operating System Concepts Essentials – 8 th Edition 11.23 Silberschatz, Galvin and Gagne ©2011
View full slide show




C-SCAN  Provides a more uniform wait time than SCAN  The head moves from one end of the disk to the other, servicing requests as it goes  When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip  Treats the cylinders as a circular list that wraps around from the last cylinder to the first one  Total number of cylinders? Operating System Concepts Essentials – 2nd Edition 9.24 Silberschatz, Galvin and Gagne ©2013
View full slide show




SCAN  The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues.  SCAN algorithm Sometimes called the elevator algorithm  Illustration shows total head movement of 208 cylinders  But note that if requests are uniformly dense, largest density at other end of disk and those wait the longest Operating System Concepts Essentials – 8 th Edition 11.21 Silberschatz, Galvin and Gagne ©2011
View full slide show




SCAN  The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues.  SCAN algorithm Sometimes called the elevator algorithm  Illustration shows total head movement of 208 cylinders  But note that if requests are uniformly dense, largest density at other end of disk and those wait the longest Operating System Concepts Essentials – 2nd Edition 9.22 Silberschatz, Galvin and Gagne ©2013
View full slide show




SCAN (Elevator) and C-Scan SCAN: Service the first request encountered in the current head direction C-Scan: Services in one direction; SCAN: Services in both directions C-Scan: Return to the beginning after each pass (circular list) Head going left Movement = 236 cylinders Head going right Movement = 382 cylinders • C-Scan: Provides a more uniform wait time than SCAN. • Repositioning to the beginning is faster than repositioning in small pieces because of acceleration and deceleration.
View full slide show




SCAN  The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues.  SCAN algorithm Sometimes called the elevator algorithm  Illustration shows total head movement of 208 cylinders Operating System Concepts with Java – 8th Edition 12.12 Silberschatz, Galvin and Gagne ©2009
View full slide show




From Idea to Solution for (int i = 0; i < list.length; i++) { select the smallest element in list[i..listSize-1]; swap the smallest with list[i], if necessary; // list[i] is in its correct position. // The next iteration apply on list[i..listSize-1] } list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] list[0] list[1] list[2] list[3] ... list[10] ... list[0] list[1] list[2] list[3] ... list[10]
View full slide show




EmptyPersistentList public public class class NonEmptyPersistentList NonEmptyPersistentList extends extends AbstractPersistentList AbstractPersistentList { { private private final final E E first; first; private private final final PersistentList PersistentList rest; rest; public public NonEmptyPersistentList(E NonEmptyPersistentList(E first, first, PersistentList PersistentList rest) rest) { { this.first this.first = = first; first; this.rest this.rest = = rest; rest; } } public public E E get(int get(int index) index) { { if(index if(index == == 0) 0) { { return return first; first; } } else else { { return return rest.get(index-1); rest.get(index-1); } } } } public public int int size() size() { { return return 1 1 + + rest.size(); rest.size(); } } public public E E first() first() { { return return first; first; } } public public PersistentList PersistentList rest() rest() { { return return rest; rest; } } public public PersistentList PersistentList append(PersistentList append(PersistentList suffix) suffix) { { return new NonEmptyPersistentList(first, rest.append(suffix)); return new NonEmptyPersistentList(first, rest.append(suffix)); } } public public PersistentList PersistentList reverse() reverse() { { return return rest.reverse().append(new rest.reverse().append(new NonEmptyPersistentList(first, NonEmptyPersistentList(first, new new EmptyPersistentList())); EmptyPersistentList())); } } public public boolean boolean contains(Object contains(Object obj) obj) { { return return first.equals(obj) first.equals(obj) || || rest.contains(obj); rest.contains(obj); } } public public boolean boolean isEmpty() isEmpty() { { return return false; false; } } public public PersistentList PersistentList add(E add(E elem) elem) { { return return new new NonEmptyPersistentList(elem, NonEmptyPersistentList(elem, this); this); } } } }
View full slide show




Disk Scheduling  The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk bandwidth  Access time has two major components  Seek time is the time for the disk to move the heads to the cylinder containing the desired sector  Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head  Minimize seek time  Seek time  seek distance  Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of the last transfer Operating System Concepts with Java – 8th Edition 12.8 Silberschatz, Galvin and Gagne ©2009
View full slide show