1.
Inter process communication
2. Inter process communication
Protection and Security
3. Device management
Secondary-Storage Structures
Secondary Storage Structure
Disk is secondary storage that is used to store data
The data is provided to user programs by means of I/O requests.
Disk Structure
Disk is divided into tracks cylinder and sectors.
Data is stored on series of magnetic disks called Platters,
connected by spindle.
Surface of platter is divided into circular rings called Tracks
Tracks are divided into Sectors.
Sectors are of fixed sized.
Tracks are one arm position form a cylinder.
Secondary Storage Structure
Cylinder contains one track per platter surface.
Sector stores 512 or 1024 bytes of user data.
Sector is identified by: Cylinder no., track no. with in cylinder
and position no. In track.
Cylinder is numbered starting with zero , from outer to inner most
cylinder
Tracks are numbered starting with zero from top track to bottom
Sector start with zero ant iclock wise starting from reference position.
Magnetic Tape
Data is written on tape
Entire tape is divided into 9 tracks for storing the data
First 8 tracks will contain 8 bits and 9th track is used to
contain parity bit.
Entire tape pass through read write head
A Read/Write head is an Array of 9 read/write heads
Data is stored in the form of records
Multiple bytes form a record.
Magnetic Disk
Disk Surface
Moving-head Disk Machanism
Mass Storage Structure
Seek Time: It is the time required to move a head to the required
track.
Latency Time: It is the amount of time it takes the portion of disk on
which data record is stored to spin under read/write head.
Transfer time: time spent in actually moving data to from the disk
surface.
It is amount of information to be read, the number of bytes per track and
rotation speed.
Total Access Time: it is Seek time + Latency Time + Transfer Time
Disk Scheduling
Scheduling is mechanism of arranging requests in order to save un-necessary
rotations by disk arm and disk pointer.
OS takes I/O requests from queue and process them one by one. Algo. used to
select which I/O request is going to be selected first is called Disk
Scheduling Algorithm
Objective:
1. Minimize response time
2. Maximize Throughput.
Response Time: Avg. time that a request must wait before it is satisfied
Throughput: Avg. number of requests satisfied per unit of time.
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 are 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
FCFS
Several algorithms exist to schedule the servicing of disk I/O
requests.
A disk size of 200 tracks receives the requests for the blocks for I/O
operation. No. of blocks requested on disk are:
98, 183, 37, 122, 14, 124, 65, 67
Head pointer/ Disk arm is at 53
FCFS
Illustration shows total head movement of 640 cylinders.
FCFS
Illustration shows total head movement of 640 cylinders.
Total Head Movements:
|53-98| + |98-183| + |183- 37| + | 37-122| + |122-14| + |14-124| +
|124-65| + |65-67|
= 640
SSTF- Shortest Seek Time First
Selects the request with the minimum seek time from the
current head position.
SSTF scheduling is a form of SJF scheduling; may cause
starvation of some requests.
Illustration shows total head movement of 236
cylinders.
SSTF (Cont.)
5) 53-98=45
8) 53-183=130
3) 53-37=16
6)53-122=69
4)53-14=39
7) 53-124=71
1)53-65=12
2)53-67=14
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.
A request arriving behind the head will have to wait until the arm
moves to the end of the disk, reverses direction and comes back.
Sometimes called the elevator algorithm.
Illustration shows total head movement of 208 cylinders.
Example: Previously head is at 60. so from 60 we go to 53 i.e left
But if previously if head is at 5 then direction will be towards right.
By deafult: left direction.
SCAN (Cont.)
SCAN
Advantage
Throughput is better than FCFS
If a request arrive in a queue just in front of the
head, it will be serviced immediately.
Disadvantage:
The disk arm always starts from the beginning, no
matter other number of requests are present on
the other end of disk.
C-Scan
It is an enhancement of SCAN algorithm.
Head moves from one end of disk to the other servicing the request along
the way.
When the disk arm reaches the end it quickly returns to the other end
without fulfilling any request in the way
It restricts servicing request from one direction only.
My cylinder are rising from 0 to n-1 and wise versa. Next will be 0
It will move in increasing order of cylinder number.
Head will go to extreme ends.
Move towards increasing direction of cylinder number
C-Scan
Suppose a disk is having 200 cylinder from 0 to 199. disk is currently
searching for disk head 53. previous request was at head 60. the
queue of pending request is in FIFO order.
98,183,37,122,14,124,65,67.
Find total head movements.
Ans:183
LOOK or C-LOOK
Same as SCAN
Arm Does not go to end.
Will not go beyond max(1.e 183) and beyond min(i.e. 14)
Arm only goes as far as the final request in each direction,
Then it reverses direction immediately, without first going all the
way to the end of the disk.
LOOK
Total head movements: 208
Selecting a Disk-Scheduling Algorithm
SSTF is common and has a natural appeal
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.