Difference between EDF and LST CPU scheduling algorithms

1. Earliest Deadline First (EDF) :
In Earliest Deadline First scheduling algorithm, at every scheduling point the task having the shortest deadline is scheduled for the execution. It is an optimal dynamic priority-driven scheduling algorithm used in real-time systems. It uses priorities of the tasks for scheduling. In EDF, priorities to the task are assigned according to the absolute deadline. The task having shortest deadline gets the highest priority.

Example –
Suppose here are two processes P1 and P2.
Let the period of P1 be p1 = 50
Let the processing time of P1 be t1 = 25
Let the period of P2 be p2 = 75
Let the processing time of P2 be t2 = 30

Explanation :

  1. Deadline pf P1 is earlier, so priority of P1>P2.
  2. Initially P1 runs and completes its execution of 25 time.
  3. After 25 times, P2 starts to execute until 50 times, when P1 is able to execute.
  4. Now, comparing the deadline of (P1, P2) = (100, 75), P2 continues to execute.
  5. P2 completes its processing at time 55.
  6. P1 starts to execute until time 75, when P2 is able to execute.
  7. Now, again comparing the deadline of (P1, P2) = (100, 150), P1 continues to execute.
  8. Repeat the above steps.
  9. Finally at time 150, both P1 and P2 have the same deadline, so P2 will continue to execute till its processing time after which P1 starts to execute.

2. Least Slack Time (LST) :
In Least Slack Time scheduling algorithm, at every scheduling point the task having the minimum laxity is executed first. It is also a dynamic priority-driven scheduling algorithm used in real-time systems. It assigns some priority to all the tasks in the system according to their slack time. The task having the least slack time (laxity) gets the highest priority.

Example –
Process P1:
Arrival Time=0, Duration=10, Deadline=33
Process P2:
Arrival Time=4, Duration=3, Deadline=28
Process P3:
Arrival Time=5, Duration=10, Deadline=29



Explanation :

  • At time t=0:
    Only process P1 has arrived.
    P1 is executed till time t=4.
  • At time t=4: P2 has arrived.
    Slack time of P1: 33-4-6=23
    Slack time of P2: 28-4-3=21
    Hence P2 starts to execute till time t=5 when P3 arrives.
  • At time t=5:
    Slack Time of P1: 33-5-6=22
    Slack Time of P2: 28-5-2=21
    Slack Time of P3: 29-5-10=12
    Hence P3 starts to execute till time t=13
  • At time t=13:
    Slack Time of P1: 33-13-6=14
    Slack Time of P2: 28-13-2=13
    Slack Time of P3: 29-13-2=14
    Hence P2 starts to execute till time t=15
  • At time t=15:
    Slack Time of P1: 33-15-6=12
    Slack Time of P3: 29-15-2=12
    Hence P3 starts to execute till time t=16
  • At time t=16:
    Slack Time of P1: 33-16-6=11
    Slack Time of P3:29-16-=12
    Hence P1 starts to execute till time t=18 and so on.



Difference between EDF and LST scheduling algorithms :

EDF LST
Task having shortest deadline is scheduled first in it. Task having minimum slack time is scheduled first in it.
It assigns priority to tasks according to their deadlines. It assigns tasks according to their slack time.
It can be used as both static and dynamic scheduling. It is used only as dynamic scheduling.
Execution time of a task is not required. It requires execution time of a task.
It is a simple and optimal algorithm. It is a complex algorithm.
It can be implemented on any set of tasks. It can only be implemented on set of tasks having their burst time.
It completely utilizes the CPU (even sometimes 100%). It may under-utilize the CPU.
It increases the efficiency and throughput of the processor. It may decrease the efficiency and throughput of the processor.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.