Question 4 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
National Exams — December 2015 — 04-Soft-A4 Real-Time Systems. Three-hour, closed-book exam (Casio or Sharp approved calculators only). Format: six questions of equal value (20% each); any five constitute a complete paper and only the first five as they appear in the answer book are marked. All six are solved below for completeness. Where a doubt exists as to interpretation, the candidate is expected to state assumptions — engineering assumptions used below are flagged in check callouts.
Reference texts: Jane W. S. Liu, Real-Time Systems (Prentice Hall, 2000) — task models, timing requirements, FCFS/EDF scheduling, priority-driven scheduling of periodic tasks; Giorgio C. Buttazzo, Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications (Springer, 3rd ed.) — RTOS design, EDF optimality, real-time system design examples; Hermann Kopetz, Real-Time Systems: Design Principles for Distributed Embedded Applications (Springer, 2nd ed.) — distributed/embedded real-time system design; Ian Sommerville, Software Engineering (Pearson, 10th ed.) — embedded and critical-systems context; Transportation Association of Canada, Geometric Design Guide for Canadian Roads — perception-reaction time and stopping-sight-distance practice.
Question 4: FCFS vs. EDF Scheduling of Four Single-Instance Tasks (20%)
Given. Task arrival times, computation times and absolute deadlines per the table above; FCFS ties (T1, T2 both arrive at t=0) broken by listing order.
Find. (1) The FCFS completion schedule; (2) whether every task meets its deadline under FCFS; (3) the EDF completion schedule and whether it meets every deadline.
Approach. FCFS is non-preemptive and ignores deadlines entirely, so it is simulated by simply running tasks in arrival order to completion. EDF is preemptive: at every instant the ready task with the earliest absolute deadline runs, so it must be simulated event-by-event (every arrival is a potential preemption point).
FCFS schedule. T1 and T2 both arrive at t=0; by listing order T1 runs first. Each subsequent task starts the instant the previous one finishes (its own arrival having already occurred by then).
$$\text{T1: } 0\text{-}4 \quad \text{T2: } 4\text{-}7 \quad \text{T3: } 7\text{-}12 \quad \text{T4: } 12\text{-}14$$
Fig. Q4-1 — FCFS schedule. T3's deadline (9) falls inside its own execution window and T4's deadline (8) has already passed before T4 even starts.
Check FCFS against every deadline — does it work? T1 finishes at 4 (deadline 15, MET); T2 finishes at 7 (deadline 12, MET); T3 finishes at 12 but its deadline was 9 (MISSED by 3 ms); T4 finishes at 14 but its deadline was 8 (MISSED by 6 ms). FCFS does not work: it schedules purely by arrival order and is blind to deadlines, so the two tasks with the tightest deadlines (T3, T4) — which also happen to arrive latest — are forced to the back of the queue and both miss.
Re-schedule with EDF. EDF always runs the ready task with the earliest absolute deadline, preempting on every new arrival that has an earlier deadline than the task currently running.
$$\text{T2: }0\text{-}2\ (\to\text{T3 arrives, }d{=}9<d_{T2}{=}12,\text{ preempt})\qquad \text{T3: }2\text{-}5\ (\to\text{T4 arrives, }d{=}8<d_{T3}{=}9,\text{ preempt})$$
$$\text{T4: }5\text{-}7\ (\text{completes, no preemption pending})\qquad \text{T3 resumes: }7\text{-}9\qquad \text{T2 resumes: }9\text{-}10\qquad \text{T1: }10\text{-}14$$
Fig. Q4-2 — EDF schedule. T4 finishes at 7 (deadline 8), T3 at 9 (deadline 9, exactly on time), T2 at 10 (deadline 12), T1 at 14 (deadline 15) — every deadline met.
Under EDF: T4 finishes at 7 (deadline 8, MET); T3 finishes at 9 (deadline 9, MET exactly, zero slack); T2 finishes at 10 (deadline 12, MET); T1 finishes at 14 (deadline 15, MET). All four deadlines are met — EDF succeeds precisely where FCFS failed, by continuously re-ranking the ready queue on urgency (deadline proximity) instead of arrival order.