📝 Process Scheduling in operating system (35 MCQs)
CPU Scheduling and Multiprogramming Requirements
Process scheduling is a process-management function that determines which ready process receives CPU execution. When several processes compete for processor time, the operating system uses scheduling policies to select an appropriate candidate from the ready queue. Short-term scheduling controls immediate CPU allocation, while medium-term and long-term scheduling manage process suspension and admission where those facilities are implemented.
Why Ready Processes Need an Allocation Policy
In multiprogramming systems, multiple processes may be ready simultaneously, but an individual CPU core can execute only one thread at a time. A scheduling policy determines how this limited capacity is distributed. Different workloads prioritise response time, throughput, fairness, or deadline satisfaction, so no single algorithm provides optimal results for every application.
Ready Queues, Dispatching, and Preemptive Scheduling
The scheduler selects a process from the ready queue according to its scheduling algorithm. The dispatcher performs the context switch and transfers CPU control to the selected process. In preemptive scheduling, a timer interrupt or higher-priority event can interrupt the running process. Non-preemptive scheduling allows it to retain the CPU until termination or a blocking operation.
Round Robin Scheduling with a 4-Millisecond Quantum
Consider three processes arriving at time zero with CPU bursts P1 = 6 ms, P2 = 4 ms, and P3 = 2 ms. Under Round Robin with a 4 ms quantum, execution follows P1 from 0–4, P2 from 4–8, P3 from 8–10, and P1 from 10–12. All processes complete after their remaining bursts execute.
Waiting Time, Response Time, and Throughput Trade-offs
Scheduling directly influences CPU utilisation, throughput, turnaround time, waiting time, and response time. Round Robin improves responsiveness for interactive workloads, while shortest-job policies can reduce average waiting under suitable assumptions. However, very small time quanta increase context-switch overhead, and priority scheduling may cause starvation without appropriate controls. Multicore systems also require processor-affinity and load-balancing considerations.
Misconceptions About Preemption and Scheduling Algorithms
'Round Robin always selects the shortest process' is incorrect because it rotates through the ready queue. 'SJF guarantees the shortest average waiting time in every practical workload' is incorrect because its optimality assumes suitable known CPU burst information. 'A smaller quantum always improves performance' is incorrect because excessive context switching wastes CPU time.
Exam Focus: Gantt Charts and Scheduling Calculations
Construct Gantt charts for FCFS, SJF, Priority, and Round Robin scheduling using the given arrival times, burst times, and priorities. Calculate completion time, turnaround time, waiting time, and response time using their standard formulas. Pay attention to arrival order, preemption points, priority conventions, and the specified rule for resolving simultaneous scheduling events.
Key Terms of Process Scheduling
- Ready queue - Collection of processes awaiting CPU allocation.
- Quantum - Maximum Round Robin time slice.
- Dispatcher - Transfers CPU control to a process.
- Preemption - Interrupting a process before completion.
- Turnaround time - Completion time minus arrival time.
- Starvation - Indefinite postponement of process execution.
📝 All Process Scheduling in operating system MCQs
Q1. Which scheduling algorithm selects the ready process with the shortest next CPU burst?
📖 Explanation: Shortest job first chooses the process whose next CPU burst is expected to be smallest. Running short bursts first reduces the average waiting time of the processes, which is why the algorithm is theoretically optimal for that metric, though it requires knowing or predicting burst lengths.
Q2. Which queue holds processes that are in memory and ready to execute, waiting for the CPU?
📖 Explanation: The ready queue contains processes that have all the resources they need except the CPU. The scheduler selects the next process from this queue whenever the CPU becomes free. Device queues hold processes waiting for specific devices, so they serve a different purpose.
Q3. Which scheduling algorithm assigns each ready process a fixed time slice and cycles through the processes in order?
📖 Explanation: Round robin gives each process a fixed quantum in turn, and a process that does not finish is placed at the back of the ready queue. This fairness and responsiveness make it popular for time-sharing systems, although the choice of quantum strongly influences its behaviour.
Q4. Which performance measure is defined as the time from the moment a process is submitted to the moment it completes?
📖 Explanation: Turnaround time includes all the time a process spends in the system, including waiting in queues, executing on the CPU and performing input or output. Waiting time counts only the time spent in the ready queue, so the two measures differ by the total execution time of the process.
Q5. Which problem occurs when a low-priority process is continually passed over and never receives the CPU?
📖 Explanation: Starvation happens when a process waits indefinitely because higher-priority or shorter work keeps being selected first. It is distinct from deadlock, where processes hold resources and wait on each other, and from thrashing, which involves excessive paging rather than scheduling choices.
Q6. Why does round robin with a very large time quantum behave almost like first come first served?
📖 Explanation: When the quantum exceeds the typical CPU burst, each process runs to completion before the time slice expires. Preemption then almost never happens, so the scheduling order follows arrival order just as in first come first served. This shows how a single parameter moves the algorithm toward a different behaviour.
Q7. Why is it impossible to implement shortest job first exactly in a general-purpose system?
📖 Explanation: The scheduler needs to know how long each process will run before it runs, but CPU bursts depend on program behaviour that is unknown in advance. Practical systems therefore estimate the next burst from past behaviour, making the algorithm an approximation rather than an exact implementation.
Q8. Why is the time spent performing a context switch considered overhead?
📖 Explanation: During a context switch the processor saves one process's state and loads another's, and no application instructions run in that interval. The time is therefore lost to useful computation, which is why frequent switching reduces throughput even though it may improve responsiveness.
Q9. A student claims that preemptive scheduling always gives higher CPU utilization than non-preemptive scheduling. Which correction is most accurate?
📖 Explanation: Preemption can improve responsiveness, but each interruption costs a context switch. Whether utilization rises or falls depends on the workload and the switching cost, so the student's universal claim ignores the overhead side of the trade-off.
Q10. Why does aging help prevent starvation in a priority scheduling system?
📖 Explanation: Aging raises the priority of a waiting process over time, so no process remains at the bottom forever. Starvation is avoided because each waiting process eventually reaches a priority high enough to be selected. The approach keeps the benefits of priorities while ensuring fairness over time.
Q11. Why is the short-term scheduler invoked much more frequently than the long-term scheduler?
📖 Explanation: The CPU must choose a new process whenever the current one blocks, finishes or is preempted, which can happen many times per second. Admitting new jobs into memory is needed far less often. Recognising this difference in frequency clarifies the roles of the two scheduling levels.
Q12. Why does a multilevel feedback queue move a process that uses its full time slice into a lower-priority queue?
📖 Explanation: A process that consistently uses its full quantum behaves like a CPU-bound job, so demoting it approximates shortest job first. Short interactive processes that block frequently remain in higher queues and receive quick service, which balances responsiveness and throughput.
Q13. Why is the choice of time quantum described as a trade-off in round robin scheduling?
📖 Explanation: A small quantum improves responsiveness but multiplies the number of switches, adding overhead. A large quantum reduces switching but lets long processes delay short ones. The best value balances these effects, so choosing the quantum requires weighing responsiveness against overhead rather than maximising one factor.
Q14. In a preemptive priority scheduler, what happens when a high-priority process arrives while a lower-priority process is running?
📖 Explanation: In a preemptive scheduler the CPU is given to the highest-priority ready process at all times. An arriving process with higher priority interrupts the running process, which returns to the ready queue. This gives urgent work fast service at the cost of extra context switches.
Q15. Processes P1 (burst 8 ms, arrival 0), P2 (burst 4 ms, arrival 1) and P3 (burst 2 ms, arrival 2) are scheduled first come first served. What is the average waiting time?
📖 Explanation: Under first come first served, P1 runs 0 to 8 with waiting time 0, P2 runs 8 to 12 with waiting time ms, and P3 runs 12 to 14 with waiting time ms. The average is ms. The value 10.33 ms is the average turnaround time, a frequent confusion.
Q16. For the same three processes (P1 burst 8 ms arriving at 0, P2 burst 4 ms arriving at 1, P3 burst 2 ms arriving at 2), what is the average waiting time under non-preemptive shortest job first?
📖 Explanation: P1 starts at time 0 because it is the only arrival, and runs to 8 ms. Then P3 (2 ms) runs 8 to 10 with waiting time ms, and P2 runs 10 to 14 with waiting time ms. The average is ms, which is lower than the first come first served result.
Q17. Processes P1 (burst 3 ms) and P2 (burst 5 ms) both arrive at time 0 and are scheduled by round robin with a quantum of 2 ms. When does P2 complete?
📖 Explanation: P1 runs 0 to 2 and returns to the queue with 1 ms left. P2 runs 2 to 4 with 3 ms left, then P1 completes 4 to 5. P2 then runs 5 to 7 with 1 ms left and finishes 7 to 8. Recording each quantum in order is the reliable way to avoid mistakes in multi-step round robin problems.
Q18. A system's CPU is busy for 18 ms out of a 24 ms observation window. What is the CPU utilization?
📖 Explanation: CPU utilization is the fraction of time the processor performs useful work, here , which is 75 percent. The idle time of 6 ms does not contribute to utilization, so the calculation shows how much of the observation window was productive.
Q19. A context switch takes 5 microseconds, and the system performs 1000 switches per second. What fraction of each second is consumed by switching overhead?
📖 Explanation: The total switching time per second is microseconds, which is 5 milliseconds. Since a second contains 1,000,000 microseconds, the overhead is , or 0.5 percent. Small per-switch costs become noticeable when switches are very frequent.
Q20. A process has been in the ready queue since time 3 with priority 2 (lower number means higher priority). At time 5, another process arrives with priority 1 in a preemptive priority system. Which process runs at time 5?
📖 Explanation: In a preemptive priority scheduler the process with the highest priority, here the lower number 1, is selected as soon as it is ready. Arrival order does not override priority in this scheme. Remembering which numeric direction means higher priority is essential when working through such scenarios.
Q21. A student says that waiting time and turnaround time are always the same for a process. What is the error?
📖 Explanation: Turnaround time is the full time from submission to completion, and waiting time is the time spent in queues. The difference is the total CPU and I/O service time. Treating the two as equal omits the execution time from turnaround and produces incorrect performance conclusions.
Q22. A student says that shortest job first always gives the best response time for every interactive user, so round robin is never needed. What is wrong with this reasoning?
📖 Explanation: Shortest job first optimises average waiting time but can delay long processes indefinitely and depends on accurate burst estimates. Round robin provides predictable responsiveness to every interactive process. The student overlooks these differences and treats one metric as universally decisive.
Q23. A student says that when a time quantum expires, the process moves from the running state to the waiting queue. Which correction is most accurate?
📖 Explanation: Quantum expiry is a timer-driven preemption, not a request for an external event, so the process goes back to the ready queue to await its next turn. Waiting is reserved for processes blocked on input, output or another event, so the student confuses the two transitions.
Q24. A student claims that priority scheduling cannot cause starvation because priorities are fixed numbers. What is the flaw in this claim?
📖 Explanation: If higher-priority processes keep arriving, a low-priority process may never be chosen. Fixed priorities therefore create a real risk of starvation. Aging or similar techniques are used to counter this, so the student's claim overlooks an important weakness of the approach.
Q25. A student says that context switches are free because they only save a few registers, so preemption always costs nothing. Which evaluation is most accurate?
📖 Explanation: Even though saving registers is quick, the operation consumes CPU cycles that produce no application work. Across many switches the cost accumulates, and it also includes cache effects. The student's claim treats an operation with real cost as costless, which leads to an unsound conclusion about preemption.
Q26. A Gantt chart shows P1 running from 0 to 4 ms, P2 from 4 to 6 ms, P3 from 6 to 7 ms, and P1 again from 7 to 9 ms. Which statement is correct?
📖 Explanation: P1 runs in two separate intervals with other processes between them, which means it was taken off the CPU at 4 ms and resumed at 7 ms. Reading the Gantt chart this way reveals preemption and the order of execution, which is the purpose of such diagrams.
Q27. A graph plots average response time against round robin quantum size: quantum 1 ms gives 3 ms, quantum 2 ms gives 2 ms, quantum 8 ms gives 6 ms, and quantum 20 ms gives 15 ms. What is the best inference?
📖 Explanation: The response time falls from 3 ms to 2 ms as the quantum increases to 2 ms, then rises sharply at 8 ms and 20 ms. This shows an intermediate optimum: a very large quantum behaves like first come first served and hurts responsiveness. The graph supports choosing a moderate quantum.
Q28. A graph plots CPU utilization against the number of processes. Utilization rises quickly to about 90 percent with the first few processes, then levels off near 95 percent as more are added. What does this suggest?
📖 Explanation: The plateau near 95 percent indicates diminishing returns: once the CPU is nearly saturated, additional processes add little benefit while increasing contention and switching. The inference relies on the flattening curve rather than on any assumed linear relationship.
Q29. A table shows system throughput for increasing numbers of processes: throughput rises to a peak at 30 processes, then declines at 40 and 50 processes while the number of context switches grows sharply. Which conclusion is best supported?
📖 Explanation: The table pairs the drop in throughput with a rapid rise in context switches, suggesting that switching overhead consumes time that could have supported useful work. The conclusion is supported by the coincident trends, showing why there is an optimal level of multiprogramming.
Q30. Which combination best prevents starvation while still approximating shortest job first behaviour?
📖 Explanation: Shortest job first favours short bursts but can starve long jobs. Adding aging gradually increases the priority of waiting processes, so they eventually run. This combination keeps the efficiency of approximating shortest job first while guaranteeing that no process is ignored forever.
Q31. Which statement correctly describes a preemptive priority scheduler?
📖 Explanation: In a preemptive priority scheduler the CPU always serves the highest-priority ready process, so a newly arriving urgent process can interrupt a running lower-priority one. The interrupted process returns to the ready queue. This is the defining feature that distinguishes preemptive from non-preemptive priority scheduling.
Q32. Which pairing correctly matches a scheduling algorithm with its main characteristic?
📖 Explanation: Round robin assigns a fixed time quantum to each process in rotation. The other pairings contradict the basic definitions: first come first served is non-preemptive, shortest job first selects by burst length rather than randomly, and multilevel feedback queues allow processes to move between levels.
Q33. Four processes each need 6 ms of CPU time, all arrive at time 0, and round robin uses a quantum of 2 ms with no switching cost. When does the last process finish?
📖 Explanation: Each process needs three quanta, and the four processes cycle through the queue, so there are quanta of 2 ms each. The total is ms, and the last quantum belongs to the last process in the cycle, so it finishes at 24 ms. Counting quanta rather than processes avoids the common error.
Q34. A scheduler predicts the next CPU burst using exponential averaging with . The previous prediction was 10 ms and the actual most recent burst was 6 ms. What is the predicted next burst?
📖 Explanation: The formula is . Substituting gives ms. Exponential averaging balances recent behaviour against history, which is how practical schedulers approximate shortest job first without knowing future bursts.
Q35. A dispatcher performs 200 dispatches per second, and each dispatch takes 50 microseconds. What fraction of each second is spent on dispatching?
📖 Explanation: Each second the dispatcher spends microseconds, which equals 10 milliseconds. Since one second is 1,000,000 microseconds, the fraction is , or 1 percent. This modelling step shows that even modest per-dispatch costs add up when dispatch frequency is high.