Page 86 - DCAP403_Operating System
P. 86

Unit 5: Scheduling





                                   Figure 5.5: Round-Robin Scheduling                           Notes


                                           P 2           P 3
                                         4 time        2 time
                                          units         units



                                            2 units  2 units
                                P 1                                P 4
                       CPU     3 time                             3 time
                       Running  units                             units
                                      2 units            2 units



                                     2 units             2 units
                                P 8                                P 5
                               2 time                             3 time
                               units                              units
                                           2 units  2 units


                                           P 7           P 6
                                          4 time       5 time
                                          units        units


          Advantages

          Simple, low overhead, works for interactive systems

          Disadvantages

          1.   If quantum is too small, too much time wasted in context switching

          2.   If too large (i.e., longer than mean CPU burst), approaches FCFS

                 Example: Example of RR with Time Quantum = 20

                                      Process       Burst Time
                                        P              53
                                         1
                                        P              17
                                         2
                                        P              68
                                         3
                                        P              24
                                         4
          The Gantt chart is:





          Typically, higher average turnaround than SJF, but better response








                                           LOVELY PROFESSIONAL UNIVERSITY                                    79
   81   82   83   84   85   86   87   88   89   90   91