RTUComputer ScienceYr 2020 · Sem 82020

Q18Real Time Systems

Question

10 marks

Explain in detail the Rate Monotonic Scheduling (RMS) algorithm. Discuss its schedulability bounds and provide an example to illustrate its operation.

Answer

A massive mathematical dissection of Rate Monotonic Scheduling (RMS). Details the static priority assignment physics, the rigorous derivation of the Liu and Layland schedulability bound, and an absolute proof of execution via a timeline example.

RMS is the absolute foundational algorithm of Real-Time Systems. Invented by Liu and Layland in 1973, it is a Static, Preemptive, Priority-Driven scheduling algorithm mathematically engineered exclusively for independent, periodic tasks. The architectural genius of RMS lies in its extreme simplicity and its mathematically provable optimality for static priorities.

The OS does not dynamically guess priorities. Priorities are hardcoded offline using a single, rigid mathematical physics rule: The shorter the period (), the higher the absolute priority.

  • If Task A runs every 10ms, and Task B runs every 50ms, Task A is mathematically assigned the higher priority.
  • Because Priority (which is the execution Rate), the algorithm is named "Rate Monotonic".

How does an engineer mathematically guarantee that a nuclear reactor won't miss a deadline before turning it on? They use the RMS Utilization Bound.

  • First, calculate the actual Total CPU Utilization:
  • Then, calculate the strict mathematical RMS Bound based on the number of tasks ():

The Law: If , all tasks are mathematically guaranteed to meet all deadlines.

  • For , (100%)
  • For , (82.8%)
  • For , (69.3%)

This means that if you keep your CPU utilization below 69.3%, you can throw an infinite number of independent tasks at RMS, and it will mathematically NEVER miss a deadline. This provides a catastrophic safety margin for engineers.

Consider two tasks: - Task 1: (High Priority) - Task 2: (Low Priority)

  • Step 1 (Schedulability Test): . The bound for is . Since , the system is mathematically guaranteed to work.
  • Step 2 (Execution at ): Both tasks release. Task 1 has higher priority. Task 1 executes from to .
  • Step 3 (): Task 1 finishes. Task 2 violently takes the CPU and begins executing.
  • Step 4 (): Task 1 hits its next period and releases again. The OS violently preempts Task 2 (which has executed 30 out of its 35 units). Task 1 runs from to .
  • Step 5 (): Task 1 finishes. Task 2 resumes and executes its final 5 units, finishing at , well before its deadline.
RMS Execution Timeline020507075100T1 (C=20, T=50)T2 (C=35, T=100)T1 RunsT2 Runs (30 units)T1 Period (Preemption!)T1 RunsT2T2 Deadline
Back to Paper