In
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, rate-monotonic scheduling (RMS) is a priority assignment algorithm used in
real-time operating systems (RTOS) with a static-priority scheduling class. The static priorities are assigned according to the cycle duration of the job, so a shorter cycle duration results in a higher job priority.
These operating systems are generally
preemptive and have deterministic guarantees with regard to response times. Rate monotonic analysis is used in conjunction with those systems to provide scheduling guarantees for a particular application.
Introduction
A simple version of rate-monotonic analysis assumes that threads have the following properties:
*No resource sharing (processes do not share resources, ''e.g.'' a
hardware resource, a queue, or any kind of
semaphore blocking or non-blocking (
busy-waits))
*Deterministic deadlines are exactly equal to periods
*Static priorities (the task with the highest static priority that is runnable immediately preempts all other tasks)
*Static priorities assigned according to the ''rate monotonic'' conventions (tasks with shorter periods/deadlines are given higher priorities)
*Context switch times and other thread operations are free and have no impact on the model
It is a mathematical model that contains a calculated simulation of periods in a closed system, where
round-robin and
time-sharing
In computing, time-sharing is the Concurrency (computer science), concurrent sharing of a computing resource among many tasks or users by giving each Process (computing), task or User (computing), user a small slice of CPU time, processing time. ...
schedulers fail to meet the scheduling needs otherwise. Rate monotonic scheduling looks at a run modeling of all threads in the system and determines how much time is needed to meet the guarantees for the set of threads in question.
Optimality
The rate-monotonic priority assignment is ''optimal'' under the given assumptions, 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 with equal periods and deadlines, in fact in this case the algorithms are identical; in addition, deadline monotonic scheduling is optimal when deadlines are less than periods. For the task model in which deadlines can be greater than periods, Audsley's algorithm endowed with an exact schedulability test for this model finds an optimal priority assignment.
Upper bounds on utilization
Least upper bound
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 below a specific bound (depending on the number of tasks). The schedulability test for RMS is:
:
where is the utilization factor, is the computation time for process , is the release period (with deadline one period later) for process , and is the number of processes to be scheduled. For example, for two processes. When the number of processes tends towards
infinity
Infinity is something which is boundless, endless, or larger than any natural number. It is denoted by \infty, called the infinity symbol.
From the time of the Ancient Greek mathematics, ancient Greeks, the Infinity (philosophy), philosophic ...
, this expression will tend towards:
:
Therefore, a rough estimate when
is that RMS can meet all of the deadlines if total CPU utilization, , is less than 70%. The other 30% of the CPU can be dedicated to lower-priority, non-real-time tasks. For smaller values of or in cases where is close to this estimate, the calculated utilization bound should be used.
In practice, for the
process,
should represent the worst-case (i.e. longest) computation time and
should represent the worst-case deadline (i.e. shortest period) in which all processing must occur.
Relationship to queueing theory
In
queueing theory, is called the interarrival time, and is called the service time. These two parameters are often specified as rates:
:
is the arrival rate, and
:
is the service rate.
The utilization for each task, denoted , is then:
:
as above.
Upper bound for harmonic task sets
Liu and Layland noted that this bound may be relaxed to the maximum possible value of 1.0, if for tasks
,
where
and
,
is an integer multiple of
, which is to say that all tasks have a period that is not just a multiple of the shortest period,
, but instead that any task's period is a multiple of all shorter periods. This is known as an
harmonic task set. An example of this would be: