Difference between EDF and LST CPU scheduling algorithms

20 Jun, 2020
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 = 50Let the processing time of P1 be t1 = 25Let the period of P2 be p2 = 75Let the processing time of P2 be t2 = 30
Explanation :
Deadline pf P1 is earlier, so priority of P1>P2.Initially P1 runs and completes its execution of 25 time.After 25 times, P2 starts to execute until 50 times, when P1 is able to execute.Now, comparing the deadline of (P1, P2) = (100, 75), P2 continues to execute.P2 completes its processing at time 55.P1 starts to execute until time 75, when P2 is able to execute.Now, again comparing the deadline of (P1, P2) = (100, 150), P1 continues to execute.Repeat the above steps.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.
Deadline pf P1 is earlier, so priority of P1>P2.
Initially P1 runs and completes its execution of 25 time.
After 25 times, P2 starts to execute until 50 times, when P1 is able to execute.
Now, comparing the deadline of (P1, P2) = (100, 75), P2 continues to execute.
P2 completes its processing at time 55.
P1 starts to execute until time 75, when P2 is able to execute.
Now, again comparing the deadline of (P1, P2) = (100, 150), P1 continues to execute.
Repeat the above steps.
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=33Process P2:Arrival Time=4, Duration=3, Deadline=28Process 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=23Slack time of P2: 28-4-3=21Hence P2 starts to execute till time t=5 when P3 arrives.
At time t=5:Slack Time of P1: 33-5-6=22Slack Time of P2: 28-5-2=21Slack Time of P3: 29-5-10=12Hence P3 starts to execute till time t=13
At time t=13:Slack Time of P1: 33-13-6=14Slack Time of P2: 28-13-2=13Slack Time of P3: 29-13-2=14Hence P2 starts to execute till time t=15
At time t=15:Slack Time of P1: 33-15-6=12Slack Time of P3: 29-15-2=12Hence P3 starts to execute till time t=16
At time t=16:Slack Time of P1: 33-16-6=11Slack Time of P3:29-16-=12Hence P1 starts to execute till time t=18 and so on.
Difference between EDF and LST scheduling algorithms :
CPU Scheduling
Operating Systems-CPU Scheduling
Difference Between
Operating Systems
Operating Systems
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.