Module 6
Module 6
Magnetic Disks
Magnetic disks provide the bulk of secondary storage for modern computer systems.
A read -write head "flies" just above each surface of every platter.
The heads are attached to a disk arm that moves all the heads as a unit.
The set of tracks that are at one arm position makes up a cylinder.
The time required to access data from the disk is called access time.
The access time consists of the time necessary to move the disk arm to the desired cylinder, called the seek time
and the time necessary for the desired sector to rotate to the disk head, called the rotational latency.
Disks can transfer several megabytes of data per second, and they have seek times and rotational latencies of
several milliseconds.
Because the disk head flies on an extremely thin cushion of air, there is a danger that the head will make contact with
the disk surface and damage the magnetic surface.
Several kinds of buses are available, including Enhanced Integrated Drive Electronics (EIDE), Advanced Technology
Attachment (ATA), Serial ATA (SATA), Universal Serial Bus (USB), Fiber Channel (FC) and Small Computer Systems
Interface (SCSI) buses.
The data transfers on a bus are carried out by special electronic processors called controllers.
The host controller is the controller at the computer end of the bus.
To perform a disk I/O operation, the computer places a command into the host controller.
The host controller then sends the command via messages to the disk controller, and the disk controller operates
the disk-drive hardware to carry out the command.
1) Average disk access time = Average Seek time + Average Rotational delay or latency + Transfer time
4) Capacity of a disk pack = Number of surfaces x Number of tracks per surface x Number of sectors per track x
Storage capacity of one sector
5) Data transfer rate = Number of heads x Capacity of one track x Number of rotations in one second
Capacity of disk pack = Number of surfaces x Number of tracks per surface x Number of sectors per
track x Number of bytes per sector
= 16 x 128 x 256 x 512 bytes = 228 bytes = 256 MB
Data transfer rate = Number of heads x Capacity of one track x Number of rotations in one second
= 16 x (256 x 512 bytes) x 60 = 24 x 28 x 29 x 60 bytes/sec = 60 x 221 bytes/sec = 120 MBps
Time taken for one full rotation = (60 / 3000) sec = (1 / 50) sec = 0.02 sec = 20 msec
Average rotational delay = 1/2 x Time taken for one full rotation
= 1/2 x 20 msec = 10 msec
Average access time = Average seek time + Average rotational delay + Other factors
= 11.5 msec + 10 msec + 0
= 21.5 msec
Time taken for one full rotation = (60 / 6000) sec = (1 / 100) sec = 0.01 sec = 10 msec
Average rotational delay = 1/2 x Time taken for one full rotation = 1/2 x 10 msec = 5 msec
Transfer time = (512 bytes / 40 KB) sec = 0.0125 sec = 12.5 msec
Average access time = Average seek time + Average rotational delay + Transfer time
= 5 msec + 5 msec + 12.5 msec = 22.6 msec
A certain moving arm disk storage with one head has the following specifications-
•Number of tracks per surface = 200
•Disk rotation speed = 2400 RPM
•Track storage capacity = 62500 bits
•Average latency = P msec
•Data transfer rate = Q bits/sec
What is the value of P and Q?
Time taken for one full rotation = (60 / 2400) sec = (1 / 40) sec = 0.025 sec = 25 msec
Average latency or Average rotational latency = 1/2 x Time taken for one full rotation = 1/2 x 25 msec = 12.5 msec
Data transfer rate = Number of heads x Capacity of one track x Number of rotations in one second
= 1 x 62500 bits x (2400 / 60) = 2500000 bits/sec = 2.5 x 10 6 bits/sec
Time taken for one full rotation = (60 / 15000) sec = 0.004 sec = 4 msec
Average rotational delay = 1/2 x Time taken for one full rotation = 1/2 x 4 msec = 2 msec
Disk transfer time = Time taken to read or write 512 bytes = 512 bytes / (50 x 10 6 bytes/sec) = 10.24 x 10-6 sec =
0.01024 msec
Average time to read or write 512 bytes = Average seek time + Average rotational delay + Disk transfer time
= 4 msec + 2 msec + 0.01024 msec = 6.11 msec
A hard disk system has the following parameters-
•Number of tracks = 500
•Number of sectors per track = 100
•Number of bytes per sector = 500
•Time taken by the head to move from one track to another adjacent track = 1 msec
•Rotation speed = 600 RPM
What is the average time taken for transferring 250 bytes from the disk?
Time taken for one full rotation = (60 / 600) sec = 0.1 sec = 100 msec
Average rotational delay = 1/2 x Time taken for one full rotation = 1/2 x 100 msec = 50 msec
Capacity of one track = Number of sectors per track x Number of bytes per sector = 100 x 500 bytes = 50000
bytes
Data transfer rate = Number of heads x Capacity of one track x Number of rotations in one second
= 1 x 50000 bytes x (600 / 60) = = 50000 x 10 bytes/sec = 5 x 10 5 bytes/sec
Transfer time = (250 bytes / 5 x 105 bytes) sec = 50 x 10-5 sec = 0.5 msec
Average time taken to transfer 250 bytes = Average seek time + Average rotational delay + Transfer time
= 249.5 msec + 50 msec + 0.5 msec = 300 msec
Mapping physical sectors to logical blocks
In the physical view of disk, the space in disk is divided into sectors. Sector is the smallest unit of transfer.
In the logical view of disk, the space in disk divided into blocks. Block is the smallest unit of transfer.
The physical sectors of the disk are mapped onto the logical blocks of the disk.
Sector 0 is the first sector of the first track on the outermost cylinder.
The mapping proceeds in order through that track, then through the rest of the tracks in that cylinder, and then
through the rest of the cylinders from outermost to innermost.
15 x 63 + 31 = 976
16 x 63 + 30 = 1038
16 x 63 + 31 = 1039
17 x 63 + 31 = 1102
Disk Scheduling
To use the disk efficiently, the operating system has to improve the access time and bandwidth.
The 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.
The access time and bandwidth are improved by managing the order in which the disk I/O requests are serviced.
To process or service these requests, several disk scheduling algorithms are used.
The different disk scheduling algorithms are:
3) SCAN Scheduling
4) C- SCAN Scheduling
5) LOOK Scheduling
6) C-LOOK Scheduling
First Come First Serve (FCFS) Scheduling
This algorithm is simple, but it does not provide the fastest service.
Consider a disk queue with requests for I/O to blocks on the cylinders 98, 183, 37, 122, 14, 124, 65, 67.
If the disk head is initially at cylinder 53, it will first move from 53 to 98, then to 183, 37, 122, 14, 124, 65, and finally
to 67.
The SSTF algorithm selects the request with the least seek time from the current head position.
In other words, SSTF chooses the pending request closest to the current head position.
For the example request queue (98, 183, 37, 122, 14, 124, 65, 67), the closest request to the initial head position (53)
is at cylinder 65.
After processing the request at cylinder 65, the next closest request is at cylinder 67.
Continuing, we service the request at cylinder 14, then 98, 122, 124, and finally 183.
This scheduling method results in a total head movement of only 236 cylinders.
Suppose that we have two requests in the queue, for cylinders 14 and 186, and while the request from 14 is being
serviced, a new request near 14 arrives.
This new request will be serviced next, making the request at 186 wait.
While this request is being serviced, another request close to 14 could arrive.
A continual stream of requests near one another can cause the request for cylinder 186 to wait indefinitely.
SCAN Scheduling
In the SCAN algorithm, the disk arm starts at one end of the disk and moves towards the other end, servicing
requests along the way, until it gets to the other end of the disk.
At the other end, the direction of head movement is reversed, and servicing continues.
The head continuously scans back and forth across the disk.
Before applying SCAN algorithm to schedule the requests, we need to know the direction of head movement in
addition to the head's current position.
Assuming that the disk arm is moving towards 0 and that the initial head position is again 53, the head will next
service 37 and then 14.
At cylinder 0, the arm will reverse and will move towards the other end of the disk, servicing the requests at 65, 67,
98, 122, 124, and 183.
The total head movement is 236 cylinders. This schedule is diagrammed in the following figure.
When the head reaches one end and reverses direction, very few requests are in front of the head, since these
cylinders have recently been serviced.
More requests will be at the other end of the disk and these requests have also waited the longest.
C-SCAN Scheduling
Circular SCAN (C-SCAN) is a variant of SCAN and provides a more uniform wait time.
Like SCAN, C-SCAN moves the head from one end of the disk to the other, servicing requests along the way.
When the head reaches the other end, it immediately returns to the beginning of the disk without servicing any
requests on the return trip.
Both SCAN and C-SCAN move the disk arm across the full width of the disk.
In practice, the arm goes only as far as the final request in each direction.
Then, it reverses direction immediately, without going all the way to the end of the disk.
Versions of SCAN and C-SCAN that follow this pattern are called LOOK and C-LOOK scheduling, because they look for
a request before continuing to move in a given direction.
5) Delete: Delete the file and free its space for possible reuse.
An Access Control List (ACL) is associated with each file and directory.
The ACL specifies names of users and the types of access allowed for each user.
When a user requests access to a particular file, the operating system checks the access list associated with that file.
If that user is listed for the requested access, the access is allowed.
1) Constructing ACL may be a tedious task, especially if we do not know in advance the list of users in the system.
2) The directory entry, previously of fixed size, now must be of variable size, resulting in more complicated space
management.
The above problems can be resolved by using a condensed version of Access Control List.
To implement the condensed version of ACL, the users are categorized into three groups:
2) Group: A set of users who are sharing the file and need similar access is a group.
With this protection scheme, only three fields are needed to define protection.
Each field is a collection of bits, and each bit either allows or prevents the access associated with it.
For example, the UNIX system defines three fields of 3 bits each -rwx, where r controls read access, w controls write
access, and x controls execution.
A separate field is kept for the file owner, for the file's group, and for all other users.