ITPEC FE Subject A October 2024 Question 15
An OS chooses a process for CPU execution based on a scheduling algorithm. Consider four processes, P1, P2, P3, and P4, and their corresponding arrival times along with their burst times shown in the table below. Which of the following is the correct combination of waiting times for the processes to be executed in the First-Come-First-Serve (FCFS) scheduling algorithm? Here, arrival time is when a process enters the ready queue, burst time is the time required for CPU execution, and waiting time is the time a process spends in the ready queue before CPU execution begins.
Unit: millisecond
Explanation
P1 0, P2 4, P3 6, P4 14 ms — under FCFS each process starts when the previous one ends, and its waiting time is start time minus arrival time.
Answer (b)
Why not others:
- •(a) 0, 2, 4, 5 — the arrival times copied from the table, not the waiting times
- •(c) 6, 4, 9, 7 — the burst times; burst time is time on the CPU, not time spent in the ready queue
- •(d) 6, 6, 13, 12 — gives P1 a 6 ms wait, but P1 arrives at 0 on an idle CPU and starts at once; the later values do not match the start times 6, 10, 19 either
Key rule: Waiting time = start − arrival (equivalently turnaround − burst for non-preemptive scheduling); in FCFS each start is the later of the previous end and the process's own arrival.
Software · AI-written, may contain errors
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.