I'm trying to understand the example showing disadvantages of a long time quantum in Tanenbaum's book in Section 2.4.3 “Scheduling in Interactive Systems”.
To improve the CPU efficiency, we could set the quantum to, say, 100 msec. Now the wasted time is only 1%. But consider what happens on a server system if 50 requests come in within a very short time interval and with widely varying CPU requirements. Fifty processes will be put on the list of runnable processes. If the CPU is idle, the first one will start immediately, the second one may not start until 100 msec later, and so on. The unlucky last one may have to wait 5 sec before get- ting a chance, assuming all the others use their full quanta. Most users will perceive a 5-sec response to a short command as sluggish. This situation is especially bad if some of the requests near the end of the queue required only a few milliseconds of CPU time. With a short quantum they would have gotten better service.
I suppose request execution times are not known, so the order of execution of requests is chosen randomly with uniform distribution. I calculated the mean request completion times for 2 requests having execution times 1 and 2:
- infinitely small time quantum: 2.5
- infinitely large time quantum: 2.25
For the infinitely small time quantum, the 1-request completes in 2 time units since both requests are processed in parallel, then the 2-request completes in 3 time units. For the infinitely large time quantum, we have two equiprobable situations:
- the order is [1-request, 2-request], and the 1-request completes in 1 time units, then the 2-request completes in 3 time units
- the order is [2-request, 1-request], and the 2-request completes in 2 time units, then the 1-request completes in 3 time units
The mean request completion times for 3 requests having execution times 1, 2, and 3:
- infinitely small time quantum: 4.666666666666667
- infinitely large time quantum: 4
Where is the disadvantage of the infinitely large time quantum?