In computer science, rate-monotonic scheduling is an optimal, preemptive, static-priority, scheduling algorithm used in real-time operating systems. The inputs to the algorithm are processes (tasks, threads) with:
It is a statistical model. which contains a record of events. It is used in a closed environment where only a predictable number of inputs can come in. In real time systems Round robin and time sharing do not work. Whereas, Real-Monotonic Scheduling looks at the History and determines how much time a particular process generally takes , and the time of the day when these processes are expected to enter the CPU.
In 1973, Liu and Layland proved that for a set of periodic tasks with unique periods, a feasible schedule that will always meet deadlines exists if the CPU utilization is:
Where is the computation time, and is the release period (with deadline one period later.) For example for . When the number of processes tends towards infinity this expression will tend towards:
So a rough estimate is that RMS in the general case can meet all the deadlines if CPU utilization is . The other of the CPU can be dedicated to lower-priority non real-time tasks. It is known that a randomly generated periodic task system will meet all deadlines when the utilization is or less , however this fact depends on knowing the exact task statistics (periods, deadlines) and cannot be guaranteed for all task sets.
The rate monotonic priority assignment is optimal meaning that if any static priority scheduling algorithm can meet all the deadlines, then the rate monotonic algorithm can too. The deadline-monotonic scheduling algorithm is also optimal in the situation where periods and deadlines are identical, in fact in this case the algorithms are identical; in addition, deadline monotonic scheduling is also optimal when deadlines are less than periods .
An optimal static-priority scheduling algorithm when deadlines are greater than periods is an open problem.
In many practical applications, resources are shared and the unmodified RMS will be subject to priority inversion and deadlock hazards. In practice, this is solved by introducing priority inheritance.
Examples of priority inheritance algorithms include (from simplest to most complex):
OSIntEnter() and OSIntExit() primitives that lock CPU interrupts in a real-time kernel (uC-OS II kernel),
splx() family of primitives which nest the locking of device interrupts (Linux kernel),
Priority inheritance algorithms can be characterized by two parameters. First, is the inheritance lazy (only when essential) or immediate (boost priority before there is a conflict). Second is the inheritance optimistic (boost a minimum amount) or pessimistic (boost by more than the minimum amount):
| pessimistic | optimistic | |
|---|---|---|
| immediate | OSIntEnter/Exit()
| splx(), Highest Locker
|
| lazy | Priority Ceiling Protocol, Basic Priority Inheritance Protocol | |
In practice there is no mathematical difference (in terms of the Liu-Layland system utilization bound) between the lazy and immediate algorithms, and the immediate algorithms are more efficient to implement, and so they are the ones used by most practical systems.
The Basic Priority Inheritance protocol can produce chained blocking, i.e. an almost arbitrarily long delay from the time a high priority task requests a critical section, until it is served. The other protocols guarantee that at most one lower priority critical section must finish before the high priority task gets its critical section.
The Priority Ceiling Protocol is available in the VxWorks real-time kernel but is seldom enabled.
An example of usage of the Basic Priority Inheritance is related to the "Mars Pathfinder Bug" which was fixed on Mars by changing the creation flags for the semaphore so as to enable the priority inheritance.
| Process | Execution Time | Period |
|---|---|---|
| P1 | 1 | 8 |
| P2 | 2 | 5 |
| P3 | 2 | 10 |
The utilization will be:
The theoretical limit for processes will be:
Since the system is schedulable!
Scheduling algorithms | Real-time computing
Rate Monotonic Scheduling | Rate-monotonic scheduling | Rate Monotonic Scheduling
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Rate-monotonic scheduling".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world