Rate-monotonic scheduling


Rate monotonic scheduling is used in real-time operating systems and it is a priority assignment that provides a priority scheduling class. This algorithm assigns the task which has the minimum period will be given the higher priority. So, this algorithm is said a fixed priority algorithm, the time given to the task will not change and this in turn will not change the priority over time. All these priorities will not change over time as they are decided before beginning the execution process. It is a preemptive algorithm where the current process is preempted when another process with higher priority arrives. This preemption occurs based on the priority levels assigned to each process group.

Rate-monotonic process

This scheduling has an analysis process with a few of the thread assumptions and its properties are given below −

  • Priority is made to be static so that higher priority takes are executed immediately preempting other remaining tasks.

  • These priorities are assigned based on rate-monotonic conventions.

  • Sharing of resources is not allowed such as blocking or unblocking of semaphore, any hardware resources, etc.

  • The thread functions and context switching period have no restrictions and do not get affected by the model designed for execution.

This algorithm is considered optimal if it meets the given deadline and this applies to any static priority algorithm. The deadline monotonic algorithm is also said to be optimal if the given deadlines are less than the periods.

The formula given below should be satisfied by the schedule assigned and should meet its deadlines. The CPU utilization below the given lower bound is given by the formula for the least upper bound to perform the schedulable test −

$$\mathrm{U\:=\:\displaystyle\sum\limits_{i=1}^n\:(\frac{Ci}{Ti})\:\leq\:n\:(2^{\frac{1}{n}}\:−\:1)}$$

In the above formula,

Ci − Process computation time

Ti − Process period for execution (release period)

N − Number of processes

U − utilization done by the processor.

A rough value calculation is made with n>=10, then Rate monotonic algorithm will meet all the given deadlines with the utilization of CPU <70 and the remaining 30 percent can be used for lower priority tasks.

Upper bounds have been derived for the task which is multiple of shorter periods and this harmonic task has been designed by Liu and Layland. It can be represented for k harmonic tasks or chains and the above formula can be rewritten as

$$\mathrm{U\:=\:\displaystyle\sum\limits_{i=1}^n\:(\frac{Ci}{Ti})\:\leq\:n\:(2^{\frac{1}{k}}\:−\:1)}$$

When k=1 then the upper bound attains the value of 1.0, this derives the complete utilization of the CPU.

Liu and Layland processed another bound to have the tighter schedulable condition, this is termed a Hyperbolic bound and is given by the formula below −

$$\mathrm{U\:=\:\prod_{i=1}^{n}\:(Ui\:+\:1)\:\leq\:2}$$

Where U i is the utilization done by the processor.

For instance

Consider three processes with their execution time and period given in the table below, here we calculate the least upper bound to meet the scheduled deadline.

Process list

Execution rate

Time

P1

2

5

P2

1

7

P3

2

10

In the given table, P1 has the shortest period of 5 compared with other processes P2 and P3. So P1 will be executed first, then P2 and last is P3

The least upper bound is calculated based on the period/execution rate for all the given processes and adding it all together to get the utilization value.

$$\mathrm{U\:=\:\frac{2}{5}\:+\:\frac{1}{7}\:+\:\frac{2}{10}\:=\:0.742}$$

For the given three processes, we derive the scheduled system with

$\mathrm{U\:=\:3\:(2^{\frac{1}{3}}\:−\:1)\:=\:0.7796\:\gt\:0.742}$ as this condition is satisfied, the system can be scheduled with the least upper bound values.

Harmonic analysis can be made for the above task since P1 and P3 are considered harmonic subsets since P3 is 2 times P1.

$\mathrm{U_{harmonic}\:=\:K\:(2^{(\frac{1}{K})}\:−\:1)}$, k =2 so U value will be 0.82

From the total utilization U calculated, compare it with U harmonic 0.742 < 0.82 as the derived harmonic value is higher the task can be scheduled with harmonic subset values.

Conclusion

As discussed above, if the static priority algorithm would satisfy the targetted deadlines, then the rate monotonic algorithm also performs the same and it is said to be optimal. Although rate monotonic scheduling is considered optimal when deadlines are met it does not meet the maximum utilization of CPU resources. When the scheduled task period and deadlines differ from one another then it may not be optimal. Priorities are meant to be static and cannot be changed during the execution period, as they are predefined beforehand this may lead to another process for longer waiting times.

Updated on: 23-Nov-2023

390 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements