Machine-translated by Google. Questions are authored in English.
Top

Discussion

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 \gt P3 \gt P2 \gt P4\), i.e., P1 and P4 have highest and lowest priorities, respectively.
• M2 uses priority of execution for the processes as, \(P2 \gt P3 \gt P4 \gt 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?

  • A.9.00
  • B.8.75
  • C.6.50
  • D.7.50

Answer: A

The average waiting time is 9.00 ms.

All four processes arrive at time 0 and both processors are free.

  • t = 0: M1 picks its highest-priority process, P1 (runs 0 to 20). M2 picks its highest-priority process, P2 (runs 0 to 16).
  • t = 16: M2 is free. P3 and P4 are waiting, and M2 ranks P3 above P4, so P3 runs 16 to 41.
  • t = 20: M1 is free and only P4 is waiting, so P4 runs 20 to 30.

Waiting times are P1 = 0, P2 = 0, P3 = 16 and P4 = 20, so

\[ \text{average} = \frac{0 + 0 + 16 + 20}{4} = 9.00\ \text{ms} \]

The other averages do not come from a schedule that obeys both processors' priority rules; for instance, starting P3 at time 0 on either processor breaks the rule, since each processor has a higher-priority process waiting then.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.