Consider n processes sharing the CPU in a round-robin fashion. Assuming that…

1998

Consider n processes sharing the CPU in a round-robin fashion. Assuming that each process switch takes s seconds, what must be the quantum size q 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 t seconds?

  1. A.

    q <= (t - n*s)/(n - 1)

  2. B.

    q >= (t - n*s)/(n - 1)

  3. C.

    q <= (t - n*s)/(n + 1)

  4. D.

    q >= (t - n*s)/(n + 1)

Attempted by 30 students.

Show answer & explanation

Correct answer: A

To reduce overhead, the time quantum q should be as large as possible, but it must still satisfy the response-time guarantee. After one process gets the CPU, the other n - 1 processes may each run for q seconds before it gets the CPU again. During this interval there are n process switches, each costing s seconds. Therefore the maximum gap is (n - 1)q + n*s. The guarantee requires (n - 1)q + n*s <= t. Solving gives q <= (t - n*s)/(n - 1). Hence, option A is correct.

Explore the full course: Gate Guidance By Sanchit Sir