Page 152 - DCAP103_Principle of operating system
P. 152

Unit 4: Process Management-III



                                                                                                  Notes
                     flag[i] = in-cs;
                     j = 0;
                     while ((j < n) && (j == i || flag[j] != in_cs))
                       j++;
                     if ((j >= n) && (turn ++ i || flag[turn) == idle)) break;
                     }
                     turn = i;
                critical section

                     j — (turn + 1) % n:
                     while (flag [j] == idle)

                           j = (j+1) % n;
                     turn = j;
                     flag[i] = idle;

                   remainder section
                   }while (1)
                 The structure of process Pi in Eisenberg and McGuire’s algorithm.
                 Prove that the algorithm satisfies all three requirements for the critical section problem.
               5.  Demonstrate that monitors, conditional critical regions, and semaphore are all equivalent,
                 insofar as the same types of synchronization problems can be implemented with them.
               6.  Write a bounded-buffer monitor in which the buffers (portions) are embedded within the
                 monitor itself.
               7.  List three examples of deadlocks that are not related to a computer-system environment.
               8.  Is it possible to have a deadlock involving only one process? Explain your answer.
               9.  Suppose that a system is in an unsafe state. Show that it is possible for the processes to
                 complete their execution without entering a deadlock state.
              10.  Consider a system consisting of four resources of the same type that are shared by three
                 processes, each of which needs at most two resources. Show that the system is deadlock-
                 free.
              11.  Can a system detect that some of its processes are starving? If you answer “yes,” explain
                 how it  can. If you answer  “no,”  explain  how  the  system  can  deal  with  the  starvation
                 problem.

              12.  Consider the following snapshot of a system:
                                        Allocation     Max      Available

                                         A  B  C     A  B  C     A  B  C
                               P 0        0012        1520
                               P 1        1000        1750
                               P 2        1354        2356
                               P 3        0632        0652
                               P 4        0014        0656




                                             LOVELY PROFESSIONAL UNIVERSITY                                   145
   147   148   149   150   151   152   153   154   155   156   157