Interview Q&A / Operating Systems

IntermediateQuick answer1 min readUpdated 3 Oct 2026

Five processes arrive together with bursts 10, 1, 2, 1, 5 and priorities 3, 1, 4, 5, 2 (lower number is higher priority). What is the average waiting time under non-preemptive priority scheduling?

SHORT ANSWER

The order is P2, P5, P1, P3, P4. Waiting times are 0, 1, 6, 16 and 18, a total of 41, so the average is 41 / 5 = 8.2 ms.

Explain it simply

Priority scheduling serves the most important job first, like a hospital casualty ward seeing the most serious patient before the one with a cough. Here a smaller number means higher priority, and the chosen process runs to completion.

ProcessBurstPriority
P1103
P211
P324
P415
P552

Example

Sort by priority number: P2 (1), P5 (2), P1 (3), P3 (4), P4 (5).

text
| P2 | P5      | P1                 | P3  | P4 |
0    1         6                    16    18   19

Waiting time = start time, since all arrive at 0:

  • P2: 0
  • P5: 1
  • P1: 6
  • P3: 16
  • P4: 18

Total = 0 + 1 + 6 + 16 + 18 = 41. Average = 41 / 5 = 8.2 ms.

Notice that P4 has a tiny burst of 1 ms yet waits 18 ms because its priority is lowest. If higher-priority jobs kept arriving, P4 could wait forever. That is starvation, and aging is the usual fix.

What to say in the interview

"I sort by priority, lowest number first: P2, P5, P1, P3, P4. Start times are 0, 1, 6, 16 and 18, which add to 41, so the average wait is 8.2 ms. I'd also mention starvation of low-priority jobs and aging as the cure."

Common mistakes

  • Treating a larger number as higher priority without checking the convention in the question.

#scheduling#priority#worked-example

Related questions

Practise more Operating Systems questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Operating Systems quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.