A computer has two processors, and . Four processes with CPU bursts of , and 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:
- uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
- uses priority of execution for the processes as, , i.e., and 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?
View worked solution
Answer: A
We are given two processors, and , and four processes arriving at with CPU bursts of and ms, respectively.
The priority orders on the processors are:
- On :
- On :
Let's trace the scheduling step-by-step:
- At : Both and are free.
- On , the highest priority waiting process is . Thus, is scheduled on (runs from to ).
- On , the highest priority waiting process is . Thus, is scheduled on (runs from to ).
- At : becomes free. The waiting processes are and .
- On , the priority order is . Thus, is scheduled on (runs from to ).
- At : becomes free. Only is waiting.
- is scheduled on (runs from to ).
Now, we calculate the waiting times for each process:
- Waiting time of ms
- Waiting time of ms
- Waiting time of ms
- Waiting time of ms
The average waiting time is:
Free practice · Your answers on this page are not saved.
