# Earliest Deadline First (EDF) Algorithm

• It is an Optimal dynamic Priority Scheduling Algorithm
• Priorities are assigned based on the absolute deadlines of the task, earlier the deadline, higher the priority.
• It is also called as Deadline Monotonic Scheduling (DM).
• If two tasks have the same deadline, then EDF randomly select  one to execute next.
• The Schedulability condition for EDF is

where U is the processor Utilisation Factor and it never be greater than 1.

In practical, no processor will be utilised for more than 100%.

## 11 thoughts on “Earliest Deadline First (EDF) Algorithm”

1. Dash says:

I am pretty sure on the point you said, "EDF also same as Deadline monotonic" and EDF handled as absolute deadlines of task set. If it deals with absolute deadline then how it could be dynamic priority scheduler.

My arguments :
1. Deadline monotonic is a spacial case of rate monotonic(RMS) where
2. EDF runs with relative deadlines i.e at certain time intervals or specified trigger points it checks ( relative deadline = absolute deadline – present time ). so any task which will be closest to miss its deadline will get highest priority. this way the priority will be assigned DYNAMICALLY.
Any good book or ieee article could prove this.

1. v. jon says:

#include
using namespace std;

class EDF
{
int releasetime;
int executiontime;
int startingtime;
int x[3];
int e[3];
int z[3];
int d[3];

public:
};

{
int slack,period;
for(int i=0;i<3;i++)
{
cout<>releasetime;

x[i] = period;

cout<>executiontime;
e[i] = executiontime;
z[i] = slack;
}}

{
int temp,y[3];

for(int j=0;j<=2;j++)
{
y[j]=x[j];
}

for (int j=0; j<2; j++)
{
for(int k = (j+1); k < 3; k++)
{
if (y[j] =0;j–,k++)
{
}

int sum = 0;
startingtime = 0;

for(int j=0;j<=2;j++)
{

if(y[2] == x[j]){

if(d[2] < d[1] && d[2] < d[0]){

else
cout<<"("<<startingtime<<"-"<<startingtime + e[j]<<",T"<<j+1<<")\t";
startingtime = sum;
d[2] = d[2] * 2;}}}

else if(y[1] == x[j]){

if(d[1] < d[2] && d[1] < d[0]){

else
cout<<"("<<startingtime<<"-"<<startingtime + e[j]<<",T"<<j+1<<")\t";
startingtime = sum;
d[1] = d[1] * 2;}}}

else if(y[0] == x[j]){

if(d[0] < d[1] && d[0] < d[2]){

else
cout<<"("<<startingtime<<"-"<<startingtime + e[j]<<",T"<<j+1<<")\t";
startingtime = sum;
d[0] = d[0] * 2;}}}

}

}}

main()
{
EDF CPU;
Repeat:
cout<<endl;

goto Repeat;
}

2. kumar says:

hi can u send me the code for this scheduling rms and edf

3. preeti says:

heyy….plzz mail me the source code of edf algorithm

4. deepika says:

hiii ,i need the source code of edf energy saving algo..can someone plz mail d source code to me asap…

5. buddha puneeth says:

sir,
This is buddha.As a part of my final year project i need to work on EDF algorithm.Can you provide me the code as soon as possible.

6. vishal k says:

i need code for simulation for real time scheduling algorithms in c language

guys plzz send fast

7. Kirill says:

Me need this algorithm too. Help please!!