There are 5 queues: Q1, Q2, Q3, Q4, Q5, arranged from highest priority to lowest priority...
Accenture technical mcq question, verified with a worked answer. Free to practise - no sign-up.
There are 5 queues: Q1, Q2, Q3, Q4, Q5, arranged from highest priority to lowest priority (Q1 has the highest priority and Q5 has the lowest priority).
If there are five processes (P1, P2, P3, P4, P5) in each queue, how would the first process (P1) in queue Q5 be executed if fixed-priority pre-emptive scheduling is used, and a queue has absolute priority over lower-priority queues?
Show answer & explanation
In fixed-priority preemptive scheduling, the CPU always executes processes from the highest-priority queue that has work ready. P1 in Q5 cannot start execution until all processes in Q1, Q2, Q3, and Q4 have been completed, because any process in a higher-priority queue will preempt lower-priority work. This is the fundamental principle of absolute priority scheduling.
Step-by-step Derivation:
Under fixed-priority preemptive scheduling:
- The scheduler always selects the next process from the highest-priority non-empty queue.
- If a higher-priority queue becomes non-empty, the current lower-priority process is preempted.
- Since Q1 > Q2 > Q3 > Q4 > Q5 in priority, the scheduler will:
- Execute all processes in Q1 completely (with preemption handling among Q1 processes)
- Then execute all processes in Q2 completely
- Then execute all processes in Q3 completely
- Then execute all processes in Q4 completely
- Only when Q1, Q2, Q3, Q4 are ALL empty will Q5's P1 start execution
- Option C correctly states this: P1 in Q5 executes "when all higher priority queues (Q1 to Q4) are completely empty."
- Options A and B refer only to Q5's internal order, ignoring the absolute priority of higher queues.
- Option D is incorrect because B alone is false (it ignores the Q1-Q4 requirement).