*CS411/511. Operating Systems*
## Homework 2 - due April 16, 1999

Chapter 4: Review Questions 4.2, 4.6, 4.7

Chapter 5: Review Questions 5.4 (hint: draw the Gantt chart so you will
be able to compare your solution with ours), 5.6, 5.7

Take the example that you just used for Question 5.4, and apply it to the
following situations.

- (a) Calculate the average turnaround time for a Round-Robin algorithm
with
*q* set at 2. Ignore the effects of context-switching
time.

- (b) Calculate the average turnaround time for the same algorithm and
*q*, taking into effect the fact that each context switch costs
.5 units of time.

- (c) Suppose that a fourth process, P4, enters the system at time 7.6
and needs 6 units of CPU time. Also supposd that P2 and P3 are
interactive, but P1 and P4 are batch.
A multilevel queue (but not a multilevel feedback queue) is in
effect. The first queue is for interactive processes only, and
has a *q* of 1. The second queue is for batch processes,
which get up to 4 units each time they are in the CPU. Processes
are dispatched as follows: 2 processes are dispatched from the
interactive queue, followed by 1 process from the batch queue,
etc.

Calculate the average turnaround time.