Question 5 of 6: FCFS vs. EDF Scheduling of Four Single-Instance Tasks
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
Notes on this paper
Paper: National Exams, May 2016, 04-Soft-A4 Real-time Systems, 3 hours, closed book. Any five of the six questions constitute a complete paper (all questions answered below as a full study resource). Reference texts: Liu, Real-Time Systems; Buttazzo, Hard Real-Time Computing Systems; Kopetz, Real-Time Systems: Design Principles for Distributed Embedded Applications; Ogata, Modern Control Engineering.
Question 5: FCFS vs. EDF Scheduling of Four Single-Instance Tasks (20%)
Given. Four independent, single-instance (aperiodic) tasks, each with an arrival time $a_i$, a computation time $C_i$ and an absolute deadline $D_i$ (all in ms):
Task
Arrival $a_i$
Computation $C_i$
Absolute deadline $D_i$
T1
0
4
15
T2
0
3
12
T3
2
5
9
T4
5
2
8
Find. (1) The FCFS schedule and timing diagram. (2) Whether FCFS meets every deadline. (3) The EDF schedule and timing diagram, and whether EDF meets every deadline.
Approach. FCFS is non-preemptive: tasks are queued in arrival order (T1 and T2 both arrive at $t=0$; T1 is served first, in the order listed) and each runs to completion once started. EDF is preemptive: at every arrival or completion event, the processor switches to whichever ready task has the earliest absolute deadline.
Part (1) — FCFS schedule. Running each task to completion in arrival order T1→T2→T3→T4:
T1 runs $[0,4)$ — finishes at 4 (deadline 15, met).
T2 runs $[4,7)$ — finishes at 7 (deadline 12, met).
T3 arrived at $t=2$ but the CPU is busy until $t=7$; it runs $[7,12)$ — finishes at 12, but its deadline is 9: $\boxed{\text{T3 misses by 3 ms}}$.
T4 arrived at $t=5$ but the CPU is busy until $t=12$; it runs $[12,14)$ — finishes at 14, but its deadline is 8: $\boxed{\text{T4 misses by 6 ms}}$.
Figure 3 — FCFS timing diagram. T3 and T4 both finish after their absolute deadlines (red markers).
Part (2) — does FCFS work? No. FCFS runs tasks strictly in arrival order with no regard for urgency, so it lets T1 and T2 — both arriving first but with the loosest deadlines (15 ms, 12 ms) — occupy the CPU while T3 (deadline 9 ms) sits ready and idle from $t=2$ onward, and later T4 (deadline 8 ms, the tightest of all four) waits behind everything. Two of the four tasks, T3 and T4, miss their deadlines. FCFS is deadline-blind and is unsuitable whenever tasks with tight deadlines can arrive after tasks with loose ones.
Part (3) — EDF schedule. At each decision point the scheduler picks the ready task with the smallest absolute deadline, preempting the running task if a more urgent one becomes ready: