ITPEC FE Morning October 2019 Question 18
An operating system (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, the arrival time is the time at which a process arrives in the ready queue, the burst time is the time required by a process for CPU execution, and the waiting time is the period of time spent by a process in the ready queue for CPU to start the execution.
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.