Book Your slot
X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
search
Menu Login home
  • Questions

  • Library

  • University Updates

  • Informatives

  • Technology Lines

  • Training & Internships

  • X
    Menu
  • Home
  • Privacy Policy
  • Legal Disclaimer
  • Terms & Conditions
  • Return Policy
  • About Us
  • Need any help?? write to us at

    support@engineershub.co

    Follow Us

    X
    LOGIN
    Login to access posts, links, updates, question papers, materials, one liners!
    Use Your Email Address/Mobile and Password to Login
    Forgot Password?
    Not a member? Sign Up
    LOGIN WITH EMAIL/MOBILE
    Forgot Password?
    Go Back
    FORGOT PASSWORD
    Go Back
    RESET PASSWORD
    Go Back
    Continue with LinkedIn
    OR
    Fill Up a Simple Form
    Already a Member? Login
    SIGN UP
    Fill all the below details correctly and click on Next
    Go Back
    What is Round Robin Scheduling? Illustrate with an example.Can it be useful for a single user system? - EngineersHub
    Go Back
    Question
    Anvesh Kanchibhotla
    1 year ago
    1 Answer(s) posted Write an answer 2250
    Answer
    Read Mode
    Answer posted by Vinod Raj
    4 months ago

    This is one of the oldest, simplest, and widely used algorithm. It is a preemptive algorithm, primarily used in time-sharing systems where the primary requirement is to provide reasonably good response times and in general to share the system fairly among all system users. RR scheduling is similar to FCFS scheduling, but preemption is added to switch between processes. Here, the CPU time is divided into time slices ( A small unit of time ), each process is allocated a small time slice while it is running. A time quantum is generally from 10 to 100 ms. In this algorithm the CPU switches between the processes. When the time slice is expired, the CPU switches to another job.

    No process can run for more than one time slice when there are other processes waiting in the ready queue. If a process needs more CPU time to complete after exhausting one time slice, it goes to the end of the ready queue to await the next allocation.

    If the process has a CPU burst time of less than one-time slice then the process releases the CPU voluntarily. The scheduler will then proceed to the next process in the ready queue.

    Consider the three processes P1, P2, P3 which require the following CPU time.

    Process CPU time

    P1                    25

    P2                    5

    P3                    5

    Assume that the time slice is of 5ms. Then the Gantt chart is as follows.

    P1 gets the first 5ms, still, it requires another 20ms, it is preempted after the first time slice and the CPU is given to the next process i.e. P2. Since P2 just needs 5ms, it terminates as the time slice expires. The CPU is then given to the next process P3. once each process has received a one-time slice, the CPU is then returned to P1 for an additional time slice.

    Waiting time for P1 = 0 + 10 =10

    Waiting time for P2 = 5

    Waiting time for P3 = 10

     Avg. waiting time = 10 + 5 +10/3 = 25/3 = 8.33ms.

     

    Turn around time for P1 = 35 – 0 =35

    Turn around time for P2 = 10 – 0 = 10

    Turn around time for P3 = 15 – 0 = 15

    Avg. turn around time = 60/3 = 20ms.

    Therefore as we have seen, compared to the FCFS algorithm, the avg. waiting time and turn around time is comparatively less since the time quantum is involved. The performance of the RR scheduling depends very much on the time quantum.

    The time slice must be very moderate, neither small nor too frequent, or too large since if the time quantum is small, the context switch required will be much more, whereas if the time quantum is too large, RR becomes an FCFS scheduling algorithm.

    Users Joined

    Xoo
    2 hours ago
    Anil
    3 hours ago
    Ankarla
    4 hours ago
    Manvitha
    5 hours ago
    sravani
    8 hours ago
    X
    What is Round Robin Scheduling? Illustrate with an example.Can it be useful for a single user system?
    X
    What is Round Robin Scheduling? Illustrate with an example.Can it be useful for a single user system?

    This is one of the oldest, simplest, and widely used algorithm. It is a preemptive algorithm, primarily used in time-sharing systems where the primary requirement is to provide reasonably good response times and in general to share the system fairly among all system users. RR scheduling is similar to FCFS scheduling, but preemption is added to switch between processes. Here, the CPU time is divided into time slices ( A small unit of time ), each process is allocated a small time slice while it is running. A time quantum is generally from 10 to 100 ms. In this algorithm the CPU switches between the processes. When the time slice is expired, the CPU switches to another job.

    No process can run for more than one time slice when there are other processes waiting in the ready queue. If a process needs more CPU time to complete after exhausting one time slice, it goes to the end of the ready queue to await the next allocation.

    If the process has a CPU burst time of less than one-time slice then the process releases the CPU voluntarily. The scheduler will then proceed to the next process in the ready queue.

    Consider the three processes P1, P2, P3 which require the following CPU time.

    Process CPU time

    P1                    25

    P2                    5

    P3                    5

    Assume that the time slice is of 5ms. Then the Gantt chart is as follows.

    P1 gets the first 5ms, still, it requires another 20ms, it is preempted after the first time slice and the CPU is given to the next process i.e. P2. Since P2 just needs 5ms, it terminates as the time slice expires. The CPU is then given to the next process P3. once each process has received a one-time slice, the CPU is then returned to P1 for an additional time slice.

    Waiting time for P1 = 0 + 10 =10

    Waiting time for P2 = 5

    Waiting time for P3 = 10

     Avg. waiting time = 10 + 5 +10/3 = 25/3 = 8.33ms.

     

    Turn around time for P1 = 35 – 0 =35

    Turn around time for P2 = 10 – 0 = 10

    Turn around time for P3 = 15 – 0 = 15

    Avg. turn around time = 60/3 = 20ms.

    Therefore as we have seen, compared to the FCFS algorithm, the avg. waiting time and turn around time is comparatively less since the time quantum is involved. The performance of the RR scheduling depends very much on the time quantum.

    The time slice must be very moderate, neither small nor too frequent, or too large since if the time quantum is small, the context switch required will be much more, whereas if the time quantum is too large, RR becomes an FCFS scheduling algorithm.

    EngineersHub Logo
    x
    Loading...