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

**Example:**

Consider two processes P1 and P2.

Let the period of P1 be p_{1} = 50

Let the processing time of P1 be t_{1} = 25

Let the period of P2 be period_{2} = 75

Let the processing time of P2 be t_{2} = 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 DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Deadline Monotonic CPU Scheduling
- Difference between rate monotonic and deadline monotonic scheduling
- C-LOOK Disk Scheduling Algorithm
- LOOK Disk Scheduling Algorithm
- Longest Job First (LJF) CPU scheduling algorithm
- C-SCAN Disk Scheduling Algorithm
- FScan disk scheduling algorithm
- Difference between FCFS and C-LOOK disk scheduling algorithm
- Difference between SSTF and LOOK disk scheduling algorithm
- Program for SSTF disk scheduling algorithm
- Difference between C-LOOK and C-SCAN Disk Scheduling Algorithm
- Longest Remaining Time First (LRTF) CPU Scheduling Algorithm
- Difference between FCFS and SSTF Disk Scheduling Algorithm
- Shortest Job First (or SJF) CPU Scheduling Non-preemptive algorithm using Segment Tree
- Difference between C-SCAN and SSTF Disk Scheduling Algorithm
- Difference between First Come First Served (FCFS) and Round Robin (RR) Scheduling Algorithm
- Least Slack Time (LST) scheduling Algorithm in real-time systems
- Deadline scheduler in Operating System
- Difference between Multi Level Queue Scheduling (MLQ) and Priority Scheduling
- Difference between Delay and Deadline Constraint in Real-time System

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.