Earliest Deadline First (EDF) is an optimal dynamic priority scheduling algorithm used in real-time systems.
It can be used for both static and dynamic real-time scheduling.
EDF uses priorities to the jobs for scheduling. It assigns priorities to the task according to the absolute deadline. The task whose deadline is closest gets the highest priority. The priorities are assigned and changed in a dynamic fashion. EDF is very efficient as compared to other scheduling algorithms in real-time systems. It can make the CPU utilization to about 100% while still guaranteeing the deadlines of all the tasks.
EDF includes the kernel overload. In EDF, if the CPU usage is less than 100%, then it means that all the tasks have met the deadline. EDF finds an optimal feasible schedule. The feasible schedule is one in which all the tasks in the system are executed within the deadline. If EDF is not able to find a feasible schedule for all the tasks in the real-time system, then it means that no other task scheduling algorithms in real-time systems can give a feasible schedule. All the tasks which are ready for execution should announce their deadline to EDF when the task becomes runnable.
EDF scheduling algorithm does not need the tasks or processes to be periodic and also the tasks or processes require a fixed CPU burst time. In EDF, any executing task can be preempted if any other periodic instance with an earlier deadline is ready for execution and becomes active. Preemption is allowed in the Earliest Deadline First scheduling algorithm.
Consider 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 period2 = 75
Let the processing time of P2 be t2 = 30
Steps for solution:
- 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.
Limitations of EDF scheduling algorithm:
- Transient Overload Problem
- Resource Sharing Problem
- Efficient Implementation Problem
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.
- Difference between EDF and LST CPU scheduling algorithms
- Deadline Monotonic CPU Scheduling
- Difference between First Come First Served (FCFS) and Longest Job First (LJF) CPU scheduling algorithms
- Difference between Priority scheduling and Shortest Job First (SJF) CPU scheduling
- Longest Remaining Time First (LRTF) CPU Scheduling Algorithm
- Shortest Job First (or SJF) CPU Scheduling Non-preemptive algorithm using Segment Tree
- Longest Job First (LJF) CPU scheduling algorithm
- First Come, First Serve – CPU Scheduling | (Non-preemptive)
- Difference between rate monotonic and deadline monotonic scheduling
- Multilevel Feedback Queue Scheduling (MLFQ) CPU Scheduling
- Difference between Priority Scheduling and Round Robin (RR) CPU scheduling
- Program for Shortest Job First (or SJF) CPU Scheduling | Set 1 (Non- preemptive)
- Shortest Job First CPU Scheduling with predicted burst time
- Longest Remaining Time First (LRTF) CPU Scheduling Program
- Difference between First Come First Served (FCFS) and Round Robin (RR) Scheduling Algorithm
- Difference between Relative and Absolute Deadline of Real-time Task
- Difference between Delay and Deadline Constraint in Real-time System
- Deadline scheduler in Operating System
- Program for FCFS CPU Scheduling | Set 1
- Program for FCFS CPU Scheduling | Set 2 (Processes with different arrival times)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.
Improved By : pp_pankaj