Operating Systems
Computer Science Department
AAU
Chapter 6
Device Management
2
Chapter Objectives
• To describe the physical structure of secondary storage devices and
its effects on the uses of the devices.
• To explain the performance characteristics of mass-storage devices.
• To evaluate disk scheduling algorithms.
3
Topics Included
• Disk Hardware
• Disk scheduling
• Disk management
4
Disk Hardware
• All modern computers except embedded ones have disk drives.
• All real disks are organized into cylinders, each one containing many
tracks.
• Each of the tracks then will be divided into sectors
• The set of tracks that are at one arm position makes up a cylinder.
• Common platters range 3.5”, 2.5”, and 1.8”
al number of sectors
The data density as closer to the center (hub) is high
The speed increases as the read/write moves to the outer tracks
5
6
Disk Hardware(cont’d)
◼Physical geometry of a disk with two zones
◼A possible virtual geometry for this disk
7
Disk Access Time
• HDDs rotate at 60 to 250 times per second
• The time required to read or write a disk block is determined by three
factors:
• Transfer rate is rate at which data flow between drive and computer
• Positioning time is time to move disk arm to desired cylinder (seek time) and time for
desired sector to rotate under the disk head (rotational latency)
• For most disks, the seek time dominates the other two times, so reducing
the mean seek time can improve system performance substantially.
• Head crash results from disk head making contact with the disk surface
• That’s bad
8
A 3.5" HDD with Cover Removed.
9
The First Commercial Disk Drive
◼1956
◼IBM RAMDAC computer included the
IBM Model 350 disk storage system
◼5 million (7 bit) characters
◼50 x 24” platters
◼Access time = < 1 second
10
Disk Arm Scheduling Algorithm
• The OS maintains queue of requests for each I/O operation
• It uses disk scheduling algorithm
• First Come First Served (FCFS) : Accept a request one at a time and carries
them out in that order
• E.g 1. Consider a disk queue with requests for I/0 to blocks on cylinders: 1, 36, 16,
34, 9, 12
Head starts at 11
Service order: 1,36,16,34,9,12
Arm motion required: 10, 35, 20, 18, 25, 3,
Total= 111 cylinders.
• The simplest and the fairest of all, but it doesn’t improve performance
11
FCFS(cont’d)
• E.g 2. Consider a disk queue with requests for I/0 to blocks on cylinders: 98,
183, 37, 122, 14, 124, 65, 67
Total= 640 cylinders.
12
Shortest Seek First(SSF)
• It handles the closest (the least disk arm movement) request next, to
minimize seek time.
• E.g. 1 Consider a disk queue with requests for I/0 to blocks on cylinders: 1, 36,
16, 34, 9, 12
Head starts at 11
Service order: 12,9,16, 1, 34, 36
Arm motion required: 1, 3, 7, 15, 33, 2
Total= 61
• Advantage: Performance (efficiency), provides better performance
• Disadvantage: Possibility of starvation (it lacks fairness)
13
SSF(cont’d)
Shortest Seek First (SSF) disk scheduling algorithm
14
SCAN (Elevator) Algorithm
• SCAN (Elevator) Algorithm : The disk arm keeps moving in the same
direction until there are no more outstanding requests in that direction,
then it switches direction
• Direction bit 1= up, 0=down
• E.g. Track initial position: 11
Track request: 1, 36, 16, 34, 9, 12
Direction bit: 1
Service order: 12, 16, 34, 36, 9, 1
Disk arm motion: 1, 4, 18, 2, 27, 8
Total= 60 cylinders
15
SCAN Algorithm(cont’d)
The elevator algorithm for scheduling disk requests
16
C-SCAN (Modified Elevator) Algorithm
• 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
• It reduces the maximum delay experienced by new request
17
C-SCAN Algorithm(cont’d)
18
Selecting Disk- Scheduling Algorithm
• SSF is common and has a natural appeal because it increases
performance over FCFS
• SCAN and C-SCAN perform better for systems that place a heavy load on
the disk.
• Less starvation
• 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.
19
Disk Management
• Disk Formatting
• A new magnetic disk is a blank slate. Before a disk can store data, it must be divided
into sectors that the disk controller can read and write.
• 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”.
• operating system stores the initial file-system data structures onto the disk
• Boot block initializes system.
• The bootstrap is stored in ROM.
• initializes all aspects of the system, from CPU registers to device controllers and the contents
of main memory, and then starts the operating system.
• A disk that has a boot partition is called a boot disk or system disk.
• Methods such as sector sparing used to handle bad blocks.
20
Booting from disk in Windows
◼boot partition— contains the operating system and device drivers
◼Master boot record, or MBR – holds Windows boot code
21