THINK FIRST·CODE LATER

← All labs

Rate-monotonic analysis tool

Problem

Write a schedulability analyzer for periodic tasks under rate-monotonic scheduling (deadline = period, preemptive, one CPU).

Input: lines name C T until the end of input (integers).

Output:

Utilization: 0.8333
Liu-Layland bound for n=3: 0.7798
Utilization test: INCONCLUSIVE (above the bound, at most 1)
T1 (C=1, T=4, priority 1): R = 1  <= 4 OK
T2 (C=2, T=6, priority 2): R = 2 -> 3  <= 6 OK
T3 (C=3, T=12, priority 3): R = 3 -> 6 -> 7 -> 9 -> 10  <= 12 OK
Verdict: schedulable under RM
  • Utilization and bound with four decimals. Utilization test: PASS (schedulable by RM) if U ≤ bound; INCONCLUSIVE (above the bound, at most 1) if bound < U ≤ 1; FAIL (utilization above 1: impossible on one CPU) otherwise.
  • Then, for every task in priority order (shorter period first; ties in input order), run the response-time iteration Rᵢ = Cᵢ + Σ⌈Rᵢ/Tⱼ⌉·Cⱼ over higher-priority tasks, starting from Cᵢ, and print the sequence of distinct values joined by ->. Stop as soon as the value exceeds Tᵢ (print > T MISSES deadline) or stops changing (print <= T OK). Note the two spaces before <= or >.
  • Verdict: schedulable under RM if every task is OK, else Verdict: NOT schedulable under RM.

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

os5-1-data-1.txt

T1 1 4
T2 2 6
T3 3 12
What your program must print for os5-1-data-1.txt
Utilization: 0.8333
Liu-Layland bound for n=3: 0.7798
Utilization test: INCONCLUSIVE (above the bound, at most 1)
T1 (C=1, T=4, priority 1): R = 1  <= 4 OK
T2 (C=2, T=6, priority 2): R = 2 -> 3  <= 6 OK
T3 (C=3, T=12, priority 3): R = 3 -> 6 -> 7 -> 9 -> 10  <= 12 OK
Verdict: schedulable under RM

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < os5-1-data-1.txt

Windows PowerShell does not understand <:

Get-Content os5-1-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.