Given the following processes with their times and priority (lower number…

2025

Given the following processes with their times and priority (lower number indicates higher priority):
 

Process

Burst Time

Priority

P1

10

3

P2

1

1

P3

2

4

P4

1

5

P5

5

2


Which of the following is the value of average waiting time using priority scheduling algorithm?

  1. A.

    9.2

  2. B.

    6.8

  3. C.

    7.6

  4. D.

    8.2

Attempted by 219 students.

Show answer & explanation

Correct answer: D

Solution: priority scheduling (lower number = higher priority), assume non-preemptive and all processes arrive at time 0.

Execution order by priority:

  • P2 (burst 1, priority 1)

  • P5 (burst 5, priority 2)

  • P1 (burst 10, priority 3)

  • P3 (burst 2, priority 4)

  • P4 (burst 1, priority 5)

Compute waiting times (start time − arrival time; arrival = 0):

  1. P2 starts at 0, waiting time = 0

  2. P5 starts at 1 (after P2), waiting time = 1

  3. P1 starts at 6 (after P2+P5), waiting time = 6

  4. P3 starts at 16 (after P2+P5+P1), waiting time = 16

  5. P4 starts at 18 (after P2+P5+P1+P3), waiting time = 18

Total waiting time = 0 + 1 + 6 + 16 + 18 = 41

Average waiting time = 41/5 = 8.2

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor