Open In App

SCAN – EDF Scheduling in OS

Last Updated : 11 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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.

Task

Deadline

Cylinder

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

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 ‘.

Task

Deadline

Cylinder

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

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.

FAQs on SCAN-EDF Scheduling in OS

Q.1: Explain briefly about the SCAN-EDF algorithm.

Answer:

SCAN-EDF is a disk scheduling algorithm which follows the EDF algorithm along with seek optimization technique of the SCAN algorithm. It overcomes the drawbacks of the EDF algorithm in the situation where similar deadlines occur. It works by modifying the deadline values. It gives more optimal result than EDF algorithm.

Q.2: Can the SCAN-EDF algorithm be applied in case no task has same deadline?

Answer:

Applying SCAN-EDF algorithm in case no task has same deadline will give same result as that of EDF algorithm. But in such case applying EDF algorithm will give better performance as no extra compution for modification of deadline needs to be done.

Q.3: What is meant by a deadline and a cylinder in disk scheduling algorithms?

Answer:

A deadline Di is a time by which the execution of given task Ti should be completed.

A cylinder Ci refers to the track value upto which the read-write head needs to move to execute the given Task Ti .



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads