Page 135 - DCAP103_Principle of operating system
P. 135

Principles of Operating Systems



                   Notes         edge Rj + Pi is called an assignment edge. Pictorially, we represent each process Pi as
                                 a circle, and each resource type Ri as a square. Since resource type Ri may have more
                                 than  one  instance,  we  represent  each  such  instance  as  a  dot  within  the  square.  Note
                                 that a request edge points to only the square Xi, whereas an assignment edge must also
                                 designate one of the dots in the square. When process Pi requests an instance of resource
                                 type Rj, a request edge is inserted in the resource-allocation graph. When this request
                                 can be fulfilled, the request edge is instantaneously transformed to an assignment edge.
                                 When the process no longer needs access to the resource it releases the resource, and as
                                 a result the assignment edge is deleted. The resource-allocation graph shown in Figure
                                 depicts the following situation.
                                 The sets P, R, and E:

                                    •  P = {P , P , P }
                                              2
                                           1
                                                 3
                                    •  R = {R , R , R , R }
                                                 3
                                               2
                                            1
                                                    4
                                    •  E = {P  → R , P  → R , R  → P , R  → P , R  → P , R  → P }
                                                           1
                                                                2
                                                   2
                                                                               1
                                                        3
                                                                          2
                                                                   2
                                                                                       3
                                                                       2
                                                1
                                           1
                                                                                  3
                                 Resource instances:
                                    •  One instance of resource type R1
                                    •  Two instances of resource type R2
                                    •  One instance of resource type R3
                                    •  Three instances of resource type R4
                                                       Figure 4.10: Resource-Allocation Graphs


































        128                               LOVELY PROFESSIONAL UNIVERSITY
   130   131   132   133   134   135   136   137   138   139   140