Saturday, October 3, 2020

Round Robin Scheduling Algorithm in CPU

 

   What is Round Robin Scheduling Algorithm in CPU ?

   It is a preemptive scheduling algorithm where  the CPU is divided into  time slices

   The round robin scheduling algorithm is based on time sharing and multi user

   system environment where the primary requirement is to provide adequate time

   slices to  to every process fairly.

   How does the Round Robin Scheduling algorithm works?

   Every process is allocated a slot of time which is known as quantum.No process

   can rum more than one quantum while other processes are waiting in the ready

   queue. if a process needs more than one quantum it goes to the end of the ready

   queue to await the next allocation .The CPU scheduler picks the first process

   from the ready queue , allocate processor for the specified time quantum, After 

   that time the CPU scheduler will select the next process is the ready queue.

  Consider the following set of process with the processing time given in milliseconds

                                         Process    Processing Time

                                            P1                  24

                                            P2                  03

                                            P3                  03 


Here if we use a quantum of 4 milliseconds then process P1 gets the first 4 milliseconds.

since it requires another 20 milliseconds,it is given another time slot after giving time to

next slot. The Gantt Chart for the following process is given below:

 

       P1       P2          P3              P1            P1          P1              P1          P1  

0           4          7             10             14             18                22         26            30


 Process       Process Completed        Turn Around Time                 Waiting Time    

      P1                    24                                  30-0=30                                  30-24=6

      P2                    03                                  7-0 = 7                                     7-3=4

      P3                    03                                 10-0=10                                   10-3=7          


     Points to note :

       Average Turn around Time = 30+7+10/3 = 15.66

       Average waiting time =  6+4+7/3 = 5.66

       Throughput = 3/30 = 0.1

       Processor Utilization = 30/30 *100 = 100%    

    

         


  

 

 

No comments:

Post a Comment