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




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




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




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




Elevator problem • Let us define the elevator problem as: – We need to move n elevators between m floors. 1. Each elevator has a set of m buttons, one for each floor. These illuminate when pressed and cause the elevator to visit the corresponding floor. The illumination is cancelled when the corresponding floor is visited by the elevator 2. Each floor, except the first floor and the top floor has two buttons, one to request an up-elevator, and one to request a down-elevator. These buttons illuminate when pressed. The illumination is cancelled when an elevator visits the floor and then moves in the desired direction. 3. When an elevator has no requests, it remains at tis current floor with its doors closed. CS460 - Senior Design Project I (AY2004) 9
View full slide show




C:\UMBC\331\java> java.ext.dirs=C:\JDK1.2\JRE\lib\ext java.io.tmpdir=C:\WINDOWS\TEMP\ os.name=Windows 95 java.vendor=Sun Microsystems Inc. java.awt.printerjob=sun.awt.windows.WPrinterJob java.library.path=C:\JDK1.2\BIN;.;C:\WINDOWS\SYSTEM;C:\... java.vm.specification.vendor=Sun Microsystems Inc. sun.io.unicode.encoding=UnicodeLittle file.encoding=Cp1252 java.specification.vendor=Sun Microsystems Inc. user.language=en user.name=nicholas java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport... java.vm.name=Classic VM java.class.version=46.0 java.vm.specification.name=Java Virtual Machine Specification sun.boot.library.path=C:\JDK1.2\JRE\bin os.version=4.10 java.vm.version=1.2 java.vm.info=build JDK-1.2-V, native threads, symcjit java.compiler=symcjit path.separator=; file.separator=\ user.dir=C:\UMBC\331\java sun.boot.class.path=C:\JDK1.2\JRE\lib\rt.jar;C:\JDK1.2\JR... user.name=nicholas user.home=C:\WINDOWS C:\UMBC\331\java>java envSnoop -- listing properties -java.specification.name=Java Platform API Specification awt.toolkit=sun.awt.windows.WToolkit java.version=1.2 java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment user.timezone=America/New_York java.specification.version=1.2 java.vm.vendor=Sun Microsystems Inc. user.home=C:\WINDOWS java.vm.specification.version=1.0 os.arch=x86 java.awt.fonts= java.vendor.url=http://java.sun.com/ user.region=US file.encoding.pkg=sun.io java.home=C:\JDK1.2\JRE java.class.path=C:\Program Files\PhotoDeluxe 2.0\Adob... line.separator=
View full slide show




Petri nets – elevator problem • • • • • There are n elevators installed in a building with m floors. Each floor is represented by a place, F f, 1 ≤ f ≤ m. An elevator is represented by a token. A token in Ff denotes that an elevator is at floor f. Constraint – Each elevator has a set of m buttons – one for each floor. – These are illuminated when pressed, cause the elevator to travel to that floor, and turned off when the elevator arrives at that floor. – Additional places are needed to model this. • The elevator button for floor f in elevator e is denoted EB f, e with 1 ≤ f ≤ m, 1 ≤ e ≤ n • For the sake of simplicity we suppress the subscript e denoting the elevator. CS460 - Senior Design Project I (AY2004) 24
View full slide show




Disk Scheduling SCAN Disk Scheduling works like an elevator – An elevator is designed to visit floors that have people waiting. In general, an elevator moves from one extreme to the other (say, the top of the building to the bottom), servicing requests as appropriate – The SCAN disk-scheduling algorithm works in a similar way, except instead of moving up and down, the read/write heads move in toward the spindle, then out toward the platter edge, then back toward the spindle, and so forth 27
View full slide show




Disk Scheduling SCAN Disk Scheduling works like an elevator – An elevator is designed to visit floors that have people waiting. In general, an elevator moves from one extreme to the other (say, the top of the building to the bottom), servicing requests as appropriate – The SCAN disk-scheduling algorithm works in a similar way, except instead of moving up and down, the read/write heads move in toward the spindle, then out toward the platter edge, then back toward the spindle, and so forth 28
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




Finite state machines • In each of the n elevators, there are m buttons – one for each floor. These are called elevator buttons (EB). • One each floor there are two buttons to request an up and down elevator. These are called floor buttons (FB). • Let EB(e, f) denote the button in elevator e that is pressed to request floor f. • EB(e, f) can be in two states: – EBON(e, f): Elevator Button (e, f) ON. – EBOFF(e, f): Elevator Button (e, f) OFF. • If the button is on and the elevator arrives at floor f, then the button is turned off. If the button is off, and it is pressed, then the button comes on. • These two events are: – EBP(e, f): Elevator Button (e, f) Pressed. – EAF(e, f): Elevator e Arrives at Floor f. CS460 - Senior Design Project I (AY2004) 10
View full slide show




Selecting a Disk-Scheduling Algorithm  SSTF is common and has a natural appeal  SCAN and C-SCAN perform better for systems that place a heavy load on the disk  Performance depends on the number and types of requests  Requests for disk service can be influenced by the file- allocation method  The disk-scheduling algorithm should be written as a separate module of the operating system, allowing it to be replaced with a different algorithm if necessary  Either SSTF or LOOK is a reasonable choice for the default algorithm Operating System Concepts with Java – 8th Edition 12.17 Silberschatz, Galvin and Gagne ©2009
View full slide show




Disk Scheduling (Cont.)  There are many sources of disk I/O request  OS  System processes  Users processes  I/O request includes input or output mode, disk address, memory address, number of sectors to transfer  OS maintains queue of requests, per disk or device  Idle disk can immediately work on I/O request, busy disk means work must queue  Optimization algorithms only make sense when a queue exists  Note that drive controllers have small buffers and can manage a queue of I/O requests (of varying “depth”)  Several algorithms exist to schedule the servicing of disk I/O requests  The analysis is true for one or many platters  We illustrate scheduling algorithms with a request queue (0-199) 98, 183, 37, 122, 14, 124, 65, 67 Head pointer 53 Operating System Concepts Essentials – 8 th Edition 11.17 Silberschatz, Galvin and Gagne ©2011
View full slide show




Disk Management  Low-level formatting, or physical formatting — Dividing a disk into sectors that the disk controller can read and write  To use a disk to hold files, the operating system still needs to record its own data structures on the disk  Partition the disk into one or more groups of cylinders  Logical formatting or “making a file system”  To increase efficiency most file systems group blocks into clusters  Disk I/O done in blocks  File I/O done in clusters  Boot block initializes system  The bootstrap is stored in ROM  Bootstrap loader program  Methods such as sector sparing used to handle bad blocks Operating System Concepts with Java – 8th Edition 12.18 Silberschatz, Galvin and Gagne ©2009
View full slide show