A computer has two processors, π1 and π2. Four processes π1, π2, π3, π4β¦
2025
A computer has two processors, π1 and π2. Four processes π1, π2, π3, π4 with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:
β’ π1 uses priority of execution for the processes as, π1 > π3 > π2 > π4, i.e., π1 and π4 have highest and lowest priorities, respectively.Β
β’ π2 uses priority of execution for the processes as, π2 > π3 > π4 > π1, i.e., π2 and π1 have highest and lowest priorities, respectively.Β
A process ππ is scheduled to a processor ππ, if the processor is free and no other process ππ is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds
Answer: A. 9.00 β Given: Bursts: P1 = 20 ms, P2 = 16 ms, P3 = 25 ms, P4 = 10 ms (all arrive at time 0) Two processors, non-preemptive scheduling Priorities on M1: P1 > P3 > P2β¦
- A.
9.00
- B.
8.75
- C.
6.50
- D.
7.50
Attempted by 186 students.
Show answer & explanation
Correct answer: A
Given:
Bursts: P1 = 20 ms, P2 = 16 ms, P3 = 25 ms, P4 = 10 ms (all arrive at time 0)
Two processors, non-preemptive scheduling
Priorities on M1: P1 > P3 > P2 > P4
Priorities on M2: P2 > P3 > P4 > P1
Rule: When a processor becomes free, assign any waiting process provided there is no other waiting process with higher priority for that processor.
Step-by-step scheduling:
t = 0 (both processors free):
M1 runs P1 from 0 to 20 ms (P1 has highest priority on M1).
M2 runs P2 from 0 to 16 ms (P2 has highest priority on M2).
t = 16 ms (M2 becomes free; P1 still on M1):
Waiting processes: P3 and P4. For M2, P3 has higher priority than P4, so M2 runs P3 from 16 to 41 ms.
t = 20 ms (M1 becomes free; P3 running on M2):
Only P4 is waiting, and no higher-priority waiting process exists for M1, so M1 runs P4 from 20 to 30 ms.
Gantt-like view (times in ms):
M1: | P1 (0β20) | P4 (20β30) | idle (30β41)
M2: | P2 (0β16) | P3 (16β41)
Waiting times (start time β arrival time, arrival = 0):
P1: 0 ms
P2: 0 ms
P3: 16 ms
P4: 20 ms
Average waiting time = (0 + 0 + 16 + 20) / 4 = 9 ms
A video solution is available for this question β log in and enroll to watch it.
Explore the full course: Iocl Engineers Officers Grade A Paper 2