Simulate periodic tasks on one CPU over one hyperperiod (the least common multiple of the periods), in steps of 1 time unit.
Input: first line RM or EDF; then name C T per line. Every task releases a job at times 0, T, 2T, …; the job needs C units and its deadline is its next release time.
At each step:
- For every task released at time t (t > 0) whose previous job is unfinished, record a miss —
NAME missed its deadline at t=T (K units left)— and drop that job. - Release new jobs (if t < hyperperiod).
- Run one unit of the highest-priority unfinished job: RM — shortest period first; EDF — earliest absolute deadline first; ties go to the task listed first in the input. If none, the CPU is idle.
Print RM over hyperperiod H: | T1 0-2 | T2 2-5 | ... | (merged segments, idle for idle time), then the miss lines in time order, then Deadline misses: n.
Input:
EDF
T1 2 5
T2 4 7
Output:
EDF over hyperperiod 35: | T1 0-2 | T2 2-6 | T1 6-8 | T2 8-12 | T1 12-14 | T2 14-15 | T1 15-17 | T2 17-20 | T1 20-22 | T2 22-26 | T1 26-28 | T2 28-30 | T1 30-32 | T2 32-34 | idle 34-35 |
Deadline misses: 0