0% found this document useful (0 votes)
35 views17 pages

18 Rate Monotonic Scheduling 23-02-2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views17 pages

18 Rate Monotonic Scheduling 23-02-2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Earliest Dead Line First

Scheduling
• Earliest deadline first (EDF) comes under the category of the
dynamic scheduling algorithm.
• We can use it in real-time operating systems for scheduling tasks as well as
processes with specific deadlines.
• It’s a priority-based algorithm where we assign the highest priority to the
tasks with the earliest deadline.
• Additionally, the CPU executes the scheduled tasks based on priority.
• The algorithm assigns a priority to each task based on its deadline and chooses
the task with the earliest deadline for execution.
• Additionally, if multiple tasks have the same deadline, the CPU executes the
task with the highest priority.
• EDF is an optimal algorithm for scheduling a set of periodic tasks with
known deadlines and execution times as long as the total utilization of the tasks
doesn’t exceed unity.
• Hence, the total execution time of all tasks should be less than the total available
time
• The earliest deadline first scheduling algorithm consists of four steps:
initialization, task prioritization, task scheduling, and task execution.
• The first step is to initialize the available tasks. Additionally, along with
initialization, we assign each task a deadline based on completion
requirements. The next step is to assign priority to each task. The system
sorts the tasks in order of their deadlines, with the task having the earliest
deadline assigned the highest priority.
• Furthermore, the system selects the task with the earliest deadline for
execution. If multiple tasks have the same deadline, we select the task with
the highest priority.
• Finally, the CPU executes the selected task until completed or the deadline
is reached. If the task is completed before its deadline, the system returns
to the task prioritization step to select the next task for execution. If the
deadline is reached, the task is considered to be missed.
• Now before the algorithm terminates, we need to check two
conditions.
• First, we need to check whether all the tasks are executed.
• Additionally, we check if all deadlines have been missed. If one of
these conditions is met, we need to go back to the task prioritization
step and repeat the steps until the algorithm terminates.
• EDF is a dynamic scheduling algorithm where the task priority can
change over time as deadlines approach.
• Hence, the algorithm continually updates the priority of tasks based on
their deadlines and selects the task with the earliest deadline for
execution.
• CPU utilization
• Total time availability is 20
• P1=1*3=3
• P2=4*2=8
• P3=2*2=4
• Usability is 3+8+4=15
• CPU utilization is 15/20=75%
Rate-monotonic scheduling
• Rate monotonic scheduling is a priority algorithm that belongs to the
static priority scheduling category of Real Time Operating Systems.
• It is preemptive in nature.
• The priority is decided according to the cycle time of the processes
that are involved.
• If the process has a small job duration, then it has the highest priority.
• Thus if a process with highest priority starts execution, it will preempt
the other running processes.
• The priority of a process is inversely proportional to the period it will
run for.
• A set of processes can be scheduled only if they satisfy the following
equation:

Where n is the number of processes in the process set, C i is the computation time of the process, T i is
the Time period for the process to run and U is the processor utilization.
Example

n( 2^1/n - 1 ) = 3 ( 2^1/3 - 1 ) = 0.7977


U = 3/20 + 2/5 + 2/10 = 0.75

It is less than 1 or 100% utilization. The combined utilization of three processes is less than the threshold of
these processes which means the above set of processes is schedulable and thus satisfies the above equation of
the algorithm.
1.Scheduling time – For calculating the Scheduling time of the
algorithm we have to take the LCM of the Time period of all the
processes. LCM ( 20, 5, 10 ) of the above example is 20. Thus we can
schedule it by 20-time units.
2.Priority – As discussed above, the priority will be the highest for the
process which has the least running time period. Thus P2 will have the
highest priority, and after that P3 and lastly P1.
P2 > P3 > P1
• The above figure says that Process P2 will execute two times for every
5 time units, Process P3 will execute two times for every 10 time units
and Process P1 will execute three times in 20 time units. This has to be
kept in mind for understanding the entire execution of the algorithm
below.
• Process P2 will run first for 2 time units because it has the highest priority.
• After completing its two units, P3 will get the chance and thus it will run for 2 time units.
• As we know that process P2 will run 2 times in the interval of 5 time units and process P3
will run 2 times in the interval of 10 time units, they have fulfilled the criteria and thus
now process P1 which has the least priority will get the chance and it will run for 1 time.
• And here the interval of five time units have completed.
• Because of its priority P2 will preempt P1 and thus will run 2 times.
• As P3 have completed its 2 time units for its interval of 10 time units, P1 will get chance
and it will run for the remaining 2 times, completing its execution which was thrice in 20
time units.
• Now 9-10 interval remains idle as no process needs it.
• At 10 time units, process P2 will run for 2 times completing its criteria for the third
interval ( 10-15 ).
• Process P3 will now run for two times completing its execution. Interval 14-15 will again
remain idle for the same reason mentioned above.
• At 15 time unit, process P2 will execute for two times completing its execution.
• This is how the rate monotonic scheduling works.
• Conditions:
The analysis of Rate monotonic scheduling assumes few
properties that every process should possess. They are
1.Processes involved should not share the resources with other
processes.
2.Deadlines must be similar to the time periods. Deadlines are
deterministic.
3.Process running with highest priority that needs to run, will preempt
all the other processes.
4.Priorities must be assigned to all the processes according to the
protocol of Rate monotonic scheduling.
• CPU utilization
• Total time availability is 20
• P1=1*3=3
• P2=4*2=8
• P3=2*2=4
• Usability is 3+8+4=15
• CPU utilization is 15/20=75%

You might also like