Page 97 - DCAP403_Operating System
P. 97

Operating System




                    Notes          Advantages

                                   Advantages of load sharing are:
                                   1.   The load is distributed evenly across the processors assuring that no processor is idle while
                                       work is available to do.
                                   2.  No centralized scheduler is required
                                   3.  The global queue can be organized and accessed by using any of the schemes.

                                   Disadvantages

                                   Disadvantages of load sharing are:

                                   1.  The central queue copies a region of memory that must be accessed in a manner that
                                       enforces mutual exclusion.
                                   2.  Preempted threads are unlikely to resume execution on the same processor.

                                   3.  If all threads are treated as a common pool of threads it is unlikely that all the threads of a
                                       program will gain access to processors at the same time.

                                   5.7.2 Gang Scheduling

                                   1.  If closely related processes executes in parallel, synchronization blocking may be reduced.
                                   2.  Set of related threads of scheduled to run on a set of processors.

                                   3.  Gang scheduling has three parts.
                                       (a)  Groups of related threads are scheduled as a unit, a gang
                                       (b)  All members of a gang run simultaneously on different timeshared CPUs.
                                       (c)  All gang members start and end their time slices together.

                                   4.  The trick that makes gang scheduling work is that all CPU are scheduled synchronously.
                                       This means that time is divided into discrete quanta.
                                   5.  An example of how gang scheduling works is given in the Table 5.1. Here you have a
                                       multiprocessor with six CPU being used by five processes, A through E, with a total of 24

                                       ready threads.
                                                               Table 5.1: Gang Scheduling

                                                                       CPU
                                                          0        1        2        3         4        5
                                                 0        A        A        A        A        A         A
                                                           0        1        2        3         4        5
                                                 1        B        B        B        C         C        C
                                                           0        1        2        0         1        2
                                                 2        D 0      D 1      D 2      D 3      D 4       E 0

                                     Time slot   3        E 1      E 2      E 3      E 4       E 5      E 6
                                                 4        A        A        A        A        A         A
                                                           0        1        2        3         4        5
                                                 5        B        B        B        C         C        C
                                                           0        1        2        0         1        2
                                                 6        D        D        D        D        D         E
                                                           0        1        2        3         4        0
                                                 7        E        E        E        E         E        E
                                                           1        2        3        4         5        6

          90                               LOVELY PROFESSIONAL UNIVERSITY
   92   93   94   95   96   97   98   99   100   101   102