SCAN - EDF Scheduling in OS
Last Updated :
11 Oct, 2023
SCAN-EDF is a disk scheduling algorithm that is the same as the EDF algorithm but utilizes the seek optimization technique of the 'SCAN' algorithm when similar deadlines occur.
It is a hybrid algorithm. To understand the importance of this algorithm, let us first look at the drawbacks of strictly following the Earliest Deadline First (EDF) algorithm.
Consider the following situation where we have a few tasks with similar deadlines.
|
T1
| 200
| 183
|
T2
| 200
| 25
|
T3
| 200
| 150
|
T4
| 300
| 190
|
Let us apply only the EDF algorithm.
The starting position of the read-write head is '50.
Tie between the tasks with the same deadline can be broken by making any random selection. Thus the order of execution can be
T1 → T2 → T3 → T4
EDF
The total number of head movements = (183-50) + (183-25) + (150-25) + (190-150) = 456
Strictly following the EDF algorithm can cause wild to and fro motion of the disk head, resulting in huge seek time values.
We can see that there can be a better approach to handling situations where tasks with similar deadlines are released. Thus some modification is needed in the EDF algorithm.
How Does the SCAN-EDF Algorithm Work?
Let there be a total 'T' number of tasks.
Each task ' Ti ' has a corresponding deadline ' Di ' and a cylinder ' Ci '.
SCAN-EDF algorithm starts by performing modifications on the deadlines of all the tasks.
The modification is done as follows:
Di = Di + F( Ci )
Here the function ' F ' is usually taken as
F( Ci ) = ( Ci/Cmax ) - 1
Where,
- Ci - Cylinder of the task Ti
- Cmax - Cylinder of maximum value or any other suitable large value
Applying this modification causes a slight disturbance in the deadline values.
Note that any deadline Di > Dj must remain Di > Dj the after applying the modification.
Let us now apply the SCAN-EDF algorithm to the below situation. The initial position of the head is at ' 50 '.
|
T1
| 200
| 183
|
T2
| 200
| 25
|
T3
| 200
| 150
|
T4
| 300
| 190
|
Step 1: Apply modification to the deadline of all the tasks.
D1 = D1 + F( 183 ) = D1 + (183/190) - 1 = 200 + (183/190) - 1 = 199.96
D2 = D2 + F( 25 ) = D2 + (25/190) - 1 = 200 + (25/190) - 1 = 199.13
D3 = D3 + F( 150 ) = D3 + (150/190) - 1 = 200 + (150/190) - 1 = 199.79
D4 = D4 + F( 190) = D3 + (190/190) - 1 = 300 + 1 - 1 = 300
Step 2: Now apply the EDF algorithm w.r.t the above modified deadlines. The sequence of execution is going to be
T2→T3→T1→T4
SCAN-EDF The total number of head movements = (50 - 25) + (190 - 25) = 190
Thus it is clear that this algorithm overcomes the limitations of the EDF algorithm in situation where tasks with similar deadlines occur.
Note:
1) The SCAN-EDF algorithm works only in case of similar deadlines.
2) In all other cases its result is the same as the EDF algorithm.
Advantages of the SCAN-EDF Algorithm
- SCAN-EDF algorithm is a very efficient algorithm than the EDF algorithm alone.
- It uses the seek time optimization technique of the SCAN algorithm.
- Breaks the tie between tasks with the same deadline in an efficient manner.
- Simple to implement.
Disadvantages of SCAN-EDF Algorithm
- Additional computations are required which may affect seek time.
- Works the same as the EDF algorithm in case there are no same deadlines.
- Deadlines may not always be the same in real-time systems.
Similar Reads
N-Step-SCAN disk scheduling
The input-output requests that are coming from the disk are scheduled by the operating system and that scheduling of the disk is known as disk scheduling. Disk scheduling is important since multiple requests come from processes for disk but only one disk is assigned to process at a time. Seek time i
5 min read
FScan disk scheduling algorithm
Fixed period SCAN (FSCAN) disk scheduling algorithm mainly focuses on handling high variance in shortest seek time first (SSTF). SCAN algorithm is also proposed to handle above mentioned situation but using SCAN algorithm causes long delay while handling requests which are at extremes of disk. FSCAN
3 min read
C-SCAN Disk Scheduling Algorithm
Given an array of disk track numbers and initial head position, our task is to find the total number of seek operations to access all the requested tracks if a C-SCAN Disk Scheduling algorithm is used. The Circular SCAN (C-SCAN) Scheduling Algorithm is a modified version of the SCAN Disk Scheduling
12 min read
Scheduling in Airflow
Pre-requisite: Airflow When we are working on big projects in a team, we need workflow management tools that can keep track of activities and not get haywire in the sea of multiple tasks. Airflow is one of them(workflow management tool). Airflow is an open-source platform and a workflow engine that
7 min read
I/O scheduling in Operating Systems
Input/Output (I/O) operations are how a computer communicates with external devices such as hard drives, keyboards, printers, and network interfaces. These operations involve transferring data into and out of the system whether itâs reading a file, saving a document, printing, or sending data over a
6 min read
SCAN (Elevator) Disk Scheduling Algorithms
In the SCAN Disk Scheduling Algorithm, the head starts from one end of the disk and moves towards the other end, servicing requests in between one by one and reaching the other end. Then the direction of the head is reversed and the process continues as the head continuously scans back and forth to
12 min read
Deadline Monotonic CPU Scheduling
Prerequisites - CPU Scheduling Preemptive Scheduling Program for Preemptive Priority CPU Scheduling Deadline Monotonic Scheduling : It is a fixed priority based algorithm in which priorities are assigned to each task based on their relative deadline. Task with shortest deadline is assigned highest p
3 min read
Scheduling with Deadline
Prerequisite : CPU Scheduling What is Scheduling with Deadline ?The goal of a Scheduling problem is to schedule the tasks such that the maximum total profit is obtained. This algorithm for scheduling with a deadline is different from scheduling without a deadline because task completion here is asso
4 min read
CPU Scheduling in Operating Systems
CPU scheduling is a process used by the operating system to decide which task or process gets to use the CPU at a particular time. This is important because a CPU can only handle one task at a time, but there are usually many tasks that need to be processed. The following are different purposes of a
8 min read
List scheduling in Operating System
Prerequisite - CPU Scheduling List Scheduling also known as Priority List Based Scheduling is a scheduling technique in which an ordered list of processes are made by assigning them some priorities. So, basically what happens is, a list of processes that are ready to be executed at a given point is
3 min read