CS560 Midterm Exam -- Answers and Grading


Question 1 -- 10 points

Answer

When performing round-robin scheduling, you need to have a hardware timer that interrupts the CPU at regular intervals. In that way, you can give CPU-bound processes ``time-slices'' of execution. If there are n such processes, then this will make your computer appear to be n computers that run at 1/n-th the speed. What's nice though is that the I/O bound jobs will run seamlessly in this environment as well. If you didn't have the hardware timer interrupt, then a single CPU-bound process could run indefinitely, shutting out the I/O-bound processes. Thus, round-robin scheduling with a time-quantum allows interactive jobs to work well with CPU-bound jobs.

Choosing the time-quantum (the interrupt interval) is important. If the quantum is too long, then the interactive jobs will run too slowly, and lose their ability to be effective interactively. If the quantum is too short, then the operating system spends an inordinate amount of time context switching between jobs, and the computer becomes inefficient (i.e. the jobs run too slowly). The 80 percent rule is what the book offers for time quantum selection: If 80 percent of the CPU bursts expire before the time quantum expires, then the machine runs at a decent efficiency.

In the multi-level feedback queue scheduling algorithm, each queue has a different time quantum. The high-priority queue has a short quantum. The middle-priority queue has a longer one, and the lowest priority one has none. Since jobs move down the priority queue when their time quantum expires, we get a good time quantum selection for the various jobs -- the more CPU-bound ones have a longer (or no) quantum, and the I/O bound jobs not only execute in preference to the CPU-bound jobs, but they have a shorter time-quantum.

Grading

Points were allotted as follows: