Deadline Monotonic CPU Scheduling

Prerequisites –

Deadline Monotonic Scheduling :
It is a fixed priority based algorithm in which priorities are assigned to each task based on their relative deadline. Task with shortest deadline is assigned highest priority. It is a Preemptive Scheduling Algorithm that means if any task of higher priority comes then, running task is preempted and higher priority task is assigned to CPU.

Priority of task is inversely proportional to deadline i.e., task with shortest deadline is assigned highest priority. Deadline is time limit in which task has to be completed.

Task can be represented as shown in figure :



Example –
Suppose there are two tasks that need to be executed.
Task1 has release time 0, period 7 units, execution time 2 units, and deadline of 6 units ( T1 ( 0, 7, 2, 6 ) ). Task2 has release time 0, period 5 units, execution time 2 units, and deadline of 4 units ( T2 ( 0, 5, 2, 4 ) ).

Step by step explanation –

  • At T=0 both T1 and T2 are available, but deadline (T2) < deadline (T1). So T2 gets CPU and gets executed till T=2. Now T2 will be available at T=5.
  • At T=2 only T1 is available so T1 gets executed till T=4. Now T1 will be available at T=7.
  • At T=4 to T=5 CPU remains idle as not task is available for execution.
  • At T=5 only T2 is available so T2 gets executed till T=7. Now T2 will be available at T=7.
  • At T=7 only T1 is available so T1 gets executed till T=9. Now T1 will be available at T=14.
  • At T=9 to T=10 CPU remains idle as not task is available for execution.
  • At T=10 only T2 is available so T2 gets executed till T=12. Now T2 will be available at T=15.
  • At T=12 to T=14 CPU remains idle as not task is available for execution.
  • At T=14 only T1 is available so T1 gets executed till T=15. Still 1 unit of work for T1 is remaining.
  • At T=15 both T1 and T2 are available, but deadline (T2) < deadline (T1). So T2 gets CPU and gets executed till T=17. Now T2 will be available at T=20.

Complete execution process is shown in figure below –

Advantages :

  • Optimal for Static Priority Scheduling.
  • Performs well in case of availability of tasks having longer period but shorter deadline.
  • Good performance in case of overload.

Disadvantages :

  • Implementation is complex.
  • It is a time taking process.

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.