A system uses preemptive priority scheduling. Process P1 (priority 5) is running when Process P2 (priority 8) enters the ready queue. What happens immediately?
AP1 continues until it completes its CPU burst, then P2 runs
BP1 is immediately preempted and P2 is given the CPU
CP2 is added to the ready queue and P1 continues until it voluntarily blocks
DThe scheduler waits for the next clock tick before deciding whether to switch
In preemptive priority scheduling, a higher-priority process immediately interrupts whatever is currently running. P2 (priority 8) outranks P1 (priority 5), so P1 is preempted and P2 runs now. This is the defining characteristic of preemptive scheduling: the scheduler does not wait for the current process to yield or finish. Non-preemptive priority scheduling (option A) would let P1 complete its burst before switching, but the question specifies preemptive. Time-quantum waits (option D) describe round-robin scheduling.
Question 2 Multiple Choice
A batch job has been waiting in the ready queue for two hours in a priority-scheduled system, repeatedly deferred by arriving interactive tasks. What is the standard mechanism to address this?
AAssign the batch job maximum static priority at design time
BAging — the OS gradually increases the priority of processes that have waited a long time
CSwitch the entire system to FCFS to guarantee eventual execution
DReduce all interactive task priorities by half every 30 minutes
Aging is the standard solution to starvation in priority scheduling. The OS periodically increments the priority of waiting processes, so that even a low-priority process eventually reaches a high enough priority to run before newly arriving high-priority ones. This converts worst-case waiting time from potentially unbounded to bounded. Static priority changes require human intervention and don't automate protection. Switching to FCFS eliminates priority entirely, which often defeats the point. Ad-hoc priority reduction (option D) is non-standard and could destabilize the system.
Question 3 True / False
In a priority scheduling system without aging, a low-priority process can remain in the ready queue indefinitely without ever receiving CPU time.
TTrue
FFalse
Answer: True
This is starvation, and it is a genuine risk in priority scheduling. If the ready queue always contains at least one higher-priority process, the lower-priority process is perpetually deferred. In a system with continuous interactive workload (high priority) and a few background batch jobs (low priority), the batch jobs could wait hours or theoretically forever. This is not a theoretical edge case — it was observed in real systems before aging was introduced. Aging is the mechanism that converts 'potentially infinite wait' into 'bounded wait.'
Question 4 True / False
Static priorities (assigned once at process creation and seldom changed) are generally preferred over dynamic priorities in modern operating systems because they are more predictable.
TTrue
FFalse
Answer: False
Modern operating systems almost universally use dynamic priorities because they better balance responsiveness and throughput. A process that behaves as I/O-bound (frequently blocking, using short CPU bursts) gets a priority boost — it's unlikely to monopolize the CPU, and boosting it keeps I/O devices busy. A CPU-bound process gets its priority reduced to prevent monopolization. Linux's Completely Fair Scheduler and Windows' multilevel feedback queue both use dynamic priority adjustment. Static priorities are simpler but require careful manual tuning and cannot adapt to changing process behavior.
Question 5 Short Answer
Explain why aging is necessary in priority scheduling and how it prevents indefinite starvation.
Think about your answer, then reveal below.
Model answer: Without aging, a low-priority process can wait indefinitely if higher-priority processes continuously arrive — this is starvation. Aging prevents it by having the OS periodically increment the priority of every waiting process. After waiting long enough, even the lowest-priority process reaches a priority high enough to be selected before newly arriving higher-priority ones. This bounds the worst-case waiting time: instead of potentially infinite wait, every process is guaranteed to run within a time proportional to the priority differential divided by the aging rate.
The aging rate requires tuning: too slow and starvation is only marginally reduced; too fast and the priority ordering is disrupted in normal operation. In practice, aging ensures fairness as a background guarantee while preserving priority semantics during normal operation — high-priority processes still run first most of the time. The same principle motivates aging in multilevel feedback queues: processes that have been waiting a long time get promoted to higher-priority queues.