Question:

Given Data:
- Two processors: M1 M_1 and M2 M_2
- Four processes: P1,P2,P3,P4 P_1, P_2, P_3, P_4
- CPU bursts: P1=20 P_1 = 20 , P2=16 P_2 = 16 , P3=25 P_3 = 25 , P4=10 P_4 = 10
- Priority order for M1 M_1 : P1>P3>P2>P4 P_1 > P_3 > P_2 > P_4
- Priority order for M2 M_2 : P2>P3>P4>P1 P_2 > P_3 > P_4 > P_1
- Scheduling: Non-preemptive priority scheduling

Step 1: Assigning Processes to Processors
At t=0 t = 0 , both processors are free. The highest-priority process for each processor is scheduled:
- M1 M_1 gets P1 P_1 (highest priority on M1 M_1 , burst = 20 ms).
- M2 M_2 gets P2 P_2 (highest priority on M2 M_2 , burst = 16 ms).

Step 2: Scheduling Remaining Processes
- P2 P_2 finishes at t=16 t = 16 , so M2 M_2 picks the next highest-priority process, P3 P_3 (burst = 25 ms).
- P1 P_1 finishes at t=20 t = 20 , so M1 M_1 picks P4 P_4 (burst = 10 ms).
- P4 P_4 finishes at t=30 t = 30 , and P3 P_3 finishes at t=41 t = 41 .

Step 3: Calculate Waiting Times
- P1 P_1 starts at 0, so waiting time = 0 0 ms.
- P2 P_2 starts at 0, so waiting time = 0 0 ms.
- P3 P_3 starts at 16, so waiting time = 16 16 ms.
- P4 P_4 starts at 20, so waiting time = 20 20 ms.

Step 4: Compute Average Waiting Time
Average waiting time=(0+0+16+20)4=364=9 ms. \text{Average waiting time} = \frac{(0 + 0 + 16 + 20)}{4} = \frac{36}{4} = 9 \text{ ms}.

Final Answer: The average waiting time of the processes is 9 9 milliseconds.

Show Hint

In priority scheduling, the waiting time depends on the order in which processes are executed. The waiting time for each process is the total time it waits for other higher-priority processes to finish.
Updated On: Apr 4, 2025
  • 9.00
  • 8.75
  • 6.50
  • 7.50
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Initial Setup and Process Priorities
- Processor M1 M_1 priority order: P1>P3>P2>P4 P_1 > P_3 > P_2 > P_4 .
- Processor M2 M_2 priority order: P2>P3>P4>P1 P_2 > P_3 > P_4 > P_1 .
- CPU burst times:
P1=20 P_1 = 20 ms, P2=16 P_2 = 16 ms, P3=25 P_3 = 25 ms, P4=10 P_4 = 10 ms.

Step 2: Process Scheduling
- M1 M_1 schedules P1 P_1 first (highest priority), running for 20 ms.
- M2 M_2 schedules P2 P_2 first (highest priority), running for 16 ms.
- Remaining processes: P3 P_3 (25 ms), P4 P_4 (10 ms).
- M1 M_1 next schedules P3 P_3 (second priority), running for 25 ms.
- M2 M_2 next schedules P4 P_4 (second priority), running for 10 ms.

Step 3: Calculating Waiting Times
- P1 P_1 : Starts at t=0 t=0 , waiting time = 0 ms.
- P2 P_2 : Starts at t=0 t=0 , waiting time = 0 ms.
- P3 P_3 : Starts after P2 P_2 finishes, at t=16 t=16 , so waiting time = 16 ms.
- P4 P_4 : Starts after P1 P_1 finishes, at t=20 t=20 , so waiting time = 20 ms.

Step 4: Calculating Average Waiting Time
Total waiting time = 0+0+16+20=36 0 + 0 + 16 + 20 = 36 ms.
Average waiting time = 364=9 \frac{36}{4} = 9 ms.

Final Answer: The average waiting time is 9 milliseconds.
Was this answer helpful?
0
0