ITPEC FE Subject A April 2025 Question 14

Topic: Software

In a system with preemptive priority scheduling, where the smallest priority number is considered as the highest priority, there are four processes, P1, P2, P3, and P4. Their arrival times, CPU-burst times, and priorities are shown in the table below. Which of the following is the average waiting time (in ms) for the processes to be executed?

ProcessArrival timeCPU-burst time (in ms)Priority
P1082
P2211
P3423
P4634

Explanation

2.75 ms — simulate the schedule, letting a higher-priority arrival preempt the running process.

  • •0–2: P1 runs, the only process
  • •2–3: P2 arrives with priority 1, preempts P1 and finishes
  • •3–9: P1 resumes its remaining 6 ms; P3 (priority 3) and P4 (priority 4) arrive but cannot preempt priority 2
  • •9–11: P3 runs
  • •11–14: P4 runs

Waiting time = finish − arrival − burst:

  • •P1: 9 − 0 − 8 = 1
  • •P2: 3 − 2 − 1 = 0
  • •P3: 11 − 4 − 2 = 5
  • •P4: 14 − 6 − 3 = 5

Average: (1 + 0 + 5 + 5) ÷ 4 = 11 ÷ 4 = 2.75

Answer (a)

Why not others:

  • •(c) 3.25 — takes P1's wait as 3 ms, the time it resumed, forgetting it had already run 2 ms before being preempted: 13 ÷ 4
  • •(d) 3.5 — 14 ÷ 4, the average CPU-burst time (8 + 1 + 2 + 3) ÷ 4, not a waiting time
  • •(b) 3 — needs a total wait of 12 ms, but the schedule gives only 11

Key rule: Waiting time = finish − arrival − burst; it counts every period a ready process spends not running, including the time after it is preempted.

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.