Consider processes sharing the CPU in a round-robin fashion. Assuming that each process switch takes seconds, what must be the quantum size such that the overhead resulting from process switching is minimized but at the same time each process is guaranteed to get its turn at the CPU at least every seconds?
View worked solution
Answer: A
To find the optimal quantum size , let us analyze the worst-case waiting time for any process in a round-robin system with processes.
1. Calculating the Maximum Waiting Time
Suppose a process has just finished its current CPU quantum. Before can get its next turn at the CPU, all other processes must be scheduled and run for their respective quanta.
- Execution time of other processes: There are other processes, each running for at most seconds. Total execution time = seconds.
- Context switch overhead: To cycle through all processes and return to , there are exactly context switches (from , , ..., ). Each switch takes seconds. Total switching overhead = seconds.
Thus, the maximum time a process has to wait between the end of its current turn and the start of its next turn is:
2. Applying the Constraint
To guarantee that each process gets its turn at least every seconds, this waiting time must not exceed seconds:
Solving for :
3. Minimizing Overhead
To minimize the overhead caused by frequent context switching, we want the time quantum to be as large as possible. However, to satisfy the response time guarantee, must respect the upper bound derived above.
Therefore, the required condition is:
Hence, the correct option is A.
Free practice · Your answers on this page are not saved.
