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

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.

SCAN – EDF Scheduling in OS

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

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.

Similar Reads

How Does the SCAN-EDF Algorithm Work?

Let there be a total ‘T’ number of tasks....

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