<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
rate-monotonic	B-Operating_System
scheduling	I-Operating_System
(	O
RMS	O
)	O
is	O
a	O
priority	O
assignment	O
algorithm	O
used	O
in	O
real-time	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
(	O
RTOS	B-Operating_System
)	O
with	O
a	O
static-priority	B-Operating_System
scheduling	I-Operating_System
class	I-Operating_System
.	O
</s>
<s>
These	O
operating	O
systems	O
are	O
generally	O
preemptive	B-Operating_System
and	O
have	O
deterministic	O
guarantees	O
with	O
regard	O
to	O
response	O
times	O
.	O
</s>
<s>
It	O
is	O
a	O
mathematical	O
model	O
that	O
contains	O
a	O
calculated	O
simulation	O
of	O
periods	O
in	O
a	O
closed	O
system	O
,	O
where	O
round-robin	B-Algorithm
and	O
time-sharing	B-General_Concept
schedulers	O
fail	O
to	O
meet	O
the	O
scheduling	O
needs	O
otherwise	O
.	O
</s>
<s>
Rate	B-Operating_System
monotonic	I-Operating_System
scheduling	I-Operating_System
looks	O
at	O
a	O
run	O
modeling	O
of	O
all	O
threads	O
in	O
the	O
system	O
and	O
determines	O
how	O
much	O
time	O
is	O
needed	O
to	O
meet	O
the	O
guarantees	O
for	O
the	O
set	O
of	O
threads	O
in	O
question	O
.	O
</s>
<s>
The	O
deadline-monotonic	B-Operating_System
scheduling	I-Operating_System
algorithm	O
is	O
also	O
optimal	O
with	O
equal	O
periods	O
and	O
deadlines	O
,	O
in	O
fact	O
in	O
this	O
case	O
the	O
algorithms	O
are	O
identical	O
;	O
in	O
addition	O
,	O
deadline	O
monotonic	O
scheduling	O
is	O
optimal	O
when	O
deadlines	O
are	O
less	O
than	O
periods	O
.	O
</s>
<s>
proved	O
that	O
for	O
a	O
set	O
of	O
periodic	O
tasks	O
with	O
unique	O
periods	O
,	O
a	O
feasible	O
schedule	O
that	O
will	O
always	O
meet	O
deadlines	O
exists	O
if	O
the	O
CPU	B-General_Concept
utilization	O
is	O
below	O
a	O
specific	O
bound	O
(	O
depending	O
on	O
the	O
number	O
of	O
tasks	O
)	O
.	O
</s>
<s>
When	O
the	O
number	O
of	O
processes	O
tends	O
towards	O
infinity	B-Application
,	O
this	O
expression	O
will	O
tend	O
towards	O
:	O
</s>
<s>
Therefore	O
,	O
a	O
rough	O
estimate	O
when	O
is	O
that	O
RMS	O
can	O
meet	O
all	O
of	O
the	O
deadlines	O
if	O
total	O
CPU	B-General_Concept
utilization	O
,	O
,	O
is	O
less	O
than	O
70%	O
.	O
</s>
<s>
The	O
other	O
30%	O
of	O
the	O
CPU	B-General_Concept
can	O
be	O
dedicated	O
to	O
lower-priority	O
,	O
non-real-time	O
tasks	O
.	O
</s>
<s>
where	O
is	O
the	O
CPU	B-General_Concept
utilization	O
for	O
each	O
task	O
.	O
</s>
<s>
In	O
many	O
practical	O
applications	O
,	O
resources	O
are	O
shared	O
and	O
the	O
unmodified	O
RMS	O
will	O
be	O
subject	O
to	O
priority	B-Operating_System
inversion	I-Operating_System
and	O
deadlock	B-Operating_System
hazards	O
.	O
</s>
<s>
In	O
practice	O
,	O
this	O
is	O
solved	O
by	O
disabling	O
preemption	B-Operating_System
or	O
by	O
priority	B-Operating_System
inheritance	I-Operating_System
.	O
</s>
<s>
Alternative	O
methods	O
are	O
to	O
use	O
lock-free	B-Operating_System
algorithms	I-Operating_System
or	O
avoid	O
the	O
sharing	O
of	O
a	O
mutex/semaphore	O
across	O
threads	O
with	O
different	O
priorities	O
.	O
</s>
<s>
The	O
OS_ENTER_CRITICAL( )	O
and	O
OS_EXIT_CRITICAL( )	O
primitives	O
that	O
lock	O
CPU	B-General_Concept
interrupts	O
in	O
a	O
real-time	O
kernel	B-Operating_System
,	O
e.g.	O
</s>
<s>
The	O
basic	O
priority	B-Operating_System
inheritance	I-Operating_System
protocol	O
promotes	O
the	O
priority	O
of	O
the	O
task	O
that	O
holds	O
the	O
resource	O
to	O
the	O
priority	O
of	O
the	O
task	O
that	O
requests	O
that	O
resource	O
at	O
the	O
time	O
the	O
request	O
is	O
made	O
.	O
</s>
<s>
This	O
method	O
does	O
not	O
prevent	O
deadlocks	B-Operating_System
and	O
suffers	O
from	O
chained	O
blocking	O
.	O
</s>
<s>
The	O
to	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
includes	O
an	O
implementation	O
of	O
this	O
formula	O
.	O
</s>
<s>
The	O
priority	B-Operating_System
ceiling	I-Operating_System
protocol	I-Operating_System
enhances	O
the	O
basic	O
priority	B-Operating_System
inheritance	I-Operating_System
protocol	O
by	O
assigning	O
a	O
ceiling	O
priority	O
to	O
each	O
semaphore	B-Operating_System
,	O
which	O
is	O
the	O
priority	O
of	O
the	O
highest	O
job	O
that	O
will	O
ever	O
access	O
that	O
semaphore	B-Operating_System
.	O
</s>
<s>
This	O
method	O
prevents	O
deadlocks	B-Operating_System
and	O
bounds	O
the	O
blocking	O
time	O
to	O
at	O
most	O
the	O
length	O
of	O
one	O
lower	O
priority	O
critical	O
section	O
.	O
</s>
<s>
The	O
priority	B-Operating_System
ceiling	I-Operating_System
protocol	I-Operating_System
is	O
available	O
in	O
the	O
VxWorks	B-Operating_System
real-time	O
kernel	B-Operating_System
.	O
</s>
<s>
Priority	B-Operating_System
inheritance	I-Operating_System
algorithms	O
can	O
be	O
characterized	O
by	O
two	O
parameters	O
.	O
</s>
<s>
An	O
example	O
of	O
usage	O
of	O
basic	O
priority	B-Operating_System
inheritance	I-Operating_System
is	O
related	O
to	O
the	O
"	O
Mars	O
Pathfinder	O
reset	O
bug	O
"	O
which	O
was	O
fixed	O
on	O
Mars	O
by	O
changing	O
the	O
creation	O
flags	O
for	O
the	O
semaphore	B-Operating_System
so	O
as	O
to	O
enable	O
the	O
priority	B-Operating_System
inheritance	I-Operating_System
.	O
</s>
<s>
All	O
interrupt	B-General_Concept
service	I-General_Concept
routines	I-General_Concept
(	O
ISRs	O
)	O
,	O
whether	O
they	O
have	O
a	O
hard	O
real-time	O
deadline	O
or	O
not	O
should	O
be	O
included	O
in	O
RMS	O
analysis	O
to	O
determine	O
schedulability	O
in	O
cases	O
where	O
ISRs	O
have	O
priorities	O
above	O
all	O
scheduler-controlled	O
tasks	O
.	O
</s>
<s>
As	O
an	O
example	O
,	O
consider	O
a	O
hardware	B-Architecture
ISR	O
that	O
has	O
a	O
computation	O
time	O
,	O
of	O
500	O
microseconds	O
and	O
a	O
period	O
,	O
,	O
of	O
4	O
milliseconds	O
.	O
</s>
<s>
Another	O
method	O
for	O
mitigating	O
a	O
mis-prioritized	O
ISR	O
is	O
to	O
use	O
the	O
ISR	O
to	O
only	O
set	O
a	O
new	O
semaphore/mutex	O
while	O
moving	O
the	O
time-intensive	O
processing	O
to	O
a	O
new	O
process	O
that	O
has	O
been	O
appropriately	O
prioritized	O
using	O
RMS	O
and	O
will	O
block	O
on	O
the	O
new	O
semaphore/mutex	O
.	O
</s>
<s>
When	O
determining	O
schedulability	O
,	O
a	O
margin	O
of	O
CPU	B-General_Concept
utilization	O
due	O
to	O
ISR	O
activity	O
should	O
be	O
subtracted	O
from	O
the	O
least	O
upper	O
bound	O
.	O
</s>
