StreakPeaked· Practice

ExamsGATETechnical

A computer has two processors, M1 and M2. Four processes P1, P2, P3, P4 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: • M1 uses priority of execution for the processes as, P1 > P3 > P2 > P4, i.e., P1 and P4 have highest and lowest priorities, respectively. • M2 uses priority of execution for the processes as, P2 > P3 > P4 > P1, i.e., P2 and P1 have highest and lowest priorities, respectively. A process Pi is scheduled to a processor Mk, if the processor is free and no other process Pj 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?

  1. 9.00
  2. 8.75
  3. 6.50
  4. 7.50

Correct answer: 9.00

Solution

At t=0 M1 takes its top-priority P1 (0-20) and M2 takes its top-priority P2 (0-16). At t=16 M2 frees and takes P3 (16-41); at t=20 M1 frees and takes P4 (20-30). Waiting times are P1=0, P2=0, P3=16, P4=20, average = 36/4 = 9.00 ms.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →