Scheduling strategy Round Robin scheduling - Example - Operating System

Q.  Consider a uniprocessor computer system that has 2 processes and both of them alternate 10ms CPU bursts with 90ms I / O bursts. Both the processes were created at nearly the same time and can proceed in parallel. What is the scheduling strategy for this system that will result in the least CPU utilization (over a long period of time)?
- Published on 26 Aug 15

a. Round Robin scheduling with a time quantum of 5ms
b. First Come First Served scheduling
c. Shortest remaining time first
d. Static priority scheduling with different priorities for the two processes

ANSWER: Round Robin scheduling with a time quantum of 5ms
 

    Discussion

  • Nirja Shah   -Posted on 22 Nov 15
    When we use Round Robin scheduling
    - The time slice given is 5ms.
    - Let us consider process P and Q.
    - We can say that P utilizes 5ms of CPU and then Q utilizes 5ms of CPU.
    - Therefore, P starts after 15ms with I/O And Q starts after 20ms with I/O.
    - Since the I/O can be done in parallel, P finishes I\O at 105th ms (15 + 90) and Q finishes its I\O at 110th ms (20 + 90).
    - Therefore we can see that CPU remains idle from 20th to 105th ms.
    - This is when Round Robin scheduling is used,
    Idle time of CPU = 85ms
    CPU Utilization = 20/105 = 19.05%

    When we use First Come First Served scheduling scheduling or Shortest Remaining Time First
    - P will utilize 10ms of CPU and then its I/O is started.
    - Q starts its processing at 11th ms.
    - 10ms of the CPU is utilized.
    - P completes its I/O at 100ms (10 + 90)
    - Q completes its I/O at 110ms (20 + 90)
    - P again utilizes CPU at 101th ms. Hence,
    Idle time of CPU = 80ms
    CPU Utilization = 20/100 = 20%

    - As the I/O time is much more than the CPU time and only two processes are involved, "Static priority scheduling with different priorities" for the two processes reduces to FCFS or Shortest remaining time first.

    - Therefore, Round robin will result in least CPU utilization.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)