Module-5
Disk Scheduling Algorithms
Department of CSE- Data Science
Disk Scheduling
Disk scheduling algorithms are used in operating systems to optimize the order in which
disk I/O requests are serviced, with the goal of reducing disk access time and improving
overall system performance
Department of CSE- Data Science
Terminologies in Disk Scheduling
• Seek time: Time taken for the disk arm to move from one track to another.
• Rotational latency: Time taken for the desired sector to come under the read/write head.
• Transfer time: Time taken to transfer the actual data between disk and memory.
• Disk access time: Sum of seek time, rotational latency, and transfer time.
• Disk response time: Average time a request spends waiting for its turn
Department of CSE- Data Science
Disk scheduling Algorithms
1. FCFS (First Come First Serve)
2. SSTF (Shortest Seek Time First)
3. SCAN
4. C-SCAN
5. LOOK
6. C-LOOK
Department of CSE- Data Science
FCFS (First Come First Serve)
FCFS is the simplest of all Disk Scheduling Algorithms.
In FCFS, the requests are addressed in the order they arrive in the disk queue.
Total Head Movement(THM) = (98-53) + (183-98) + (183-37) + (122-37) + (122-14) +
(124-14) + (124-65) + (67-65)
THM = 640 Cylinders Department of CSE- Data Science
Shortest Seek Time First SSTF
Shortest Seek Time First selects the request with the minimum seek time from the current
head position
Total Head Movement(THM) = (65-53) + (67-65) + (67-37) + (37-14) + (98-14) +
(122-98) + (124-122) + (183-124)
THM = 236 Cylinders Department of CSE- Data Science
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
Total Head Movement(THM) =
(53-37) + (37-14) + (14-0)+(65-14)
+ (65-0)+(67-65) + (98-67) +
(122-98) + (124-122) + (183-124)
THM = 236 Cylinders
Shortcut method
(53-0)+(183-0)=236
Department of CSE- Data Science
C-SCAN
The C-SCAN algorithm, also known as the Circular SCAN algorithm, is an improved
version of the SCAN 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
Total Head Movement(THM) =
(65-53) + (67-65) + (98-67) +
(122-98) + (124-122) + (183-
124) + (199-183) + (14-0)+(37-14)
THM = 183 Cylinders
Department of CSE- Data Science
LOOK
LOOK is a variation of SCAN that does not go all the way to the end of the disk if there
are no requests in that direction.
- The head reverses direction as soon as there are no more pending requests in that
direction.
Total Head Movement(THM) =
(THM = 236 Cylinders
Shortcut method
(183-53)+(183-14)=299
Department of CSE- Data Science
C-LOOK
C-LOOK is a variation of C-SCAN that operates like LOOK but moves from the end track
to the last request in that direction before returning to the beginning track.
This reduces head movement compared to C-SCAN.
Shortcut method
(183-53)+(183-14)+(37-14)=322
Department of CSE- Data Science
PROTECTION
• Protection is a mechanism for controlling the access of programs, processes, or users to
the resources defined by a computer system.
DOMAIN OF PROTECTION
• A computer system is a collection of processes and objects. Objects are both hardware
objects (such as the CPU, memory segments, printers, disks, and tape drives) and
software objects (such as files, programs, and semaphores). Each object (resource) has a
unique name that differentiates it from all other objects in the system.
• A domain is a set of objects and types of access to these objects. Each domain is an
ordered pair of <object-name, rights-set>.
• Example, if domain D has the access right <file F,{ read,write}>, then all process executing
in domain D can both read and write file F, and cannot perform any other operation on
that object.
Department of CSE- Data Science
ACCESS MATRIX
The model of protection can be viewed abstractly as a matrix, called an access matrix.
The rows of the access matrix represent domains, and the columns represent objects.
Each entry in the matrix consists of a set of access rights.
The entry access(i,j) defines the set of operations that a process executing in domain Di
can invoke on object Oj.
Department of CSE- Data Science
For Example, consider the access matrix shown in below figure
The access matrix consists of four domains, four objects, three files and one printer.
The summary of access matrix is as follows:
o Process in domain D1 can read file F1 and file F3.
o Process in domain D2 can only use printer.
o Process in domain D3 can read file F2 and execute file F3.
o Process in domain D4 can read and write file F1 and file F3.
Department of CSE- Data Science
Each entry in the access matrix may be modified individually. Domain switch is only
possible if and only if the access right switch € access (i, j). The below figure (1) shows
the access matrix with domains as objects. Process can change domain as follows,
‣ Process in domain D2 can switch to domain D3 and domain D4.
‣ Process in domain D4 can switch to domain D1.
‣ Process in domain D1 can switch to domain D2.
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science
Department of CSE- Data Science