Monday 19 March 2012

Resource-Request Algorithm for Process Pi


   Request = request vector for process Pi.  If Requesti [j] = k then process Pi wants k instances of resource type Rj.
1.  If Requesti £ Needi go to step 2.  Otherwise, raise error condition, since process has exceeded its maximum claim.
2.  If Requesti £ Available, go to step 3.  Otherwise Pi  must wait, since resources are not available.
3.  Pretend to allocate requested resources to Pi by modifying the state as follows:
  Available = Available = Requesti;
  Allocationi = Allocationi + Requesti;
  Needi = NeediRequesti;;
If safe Þ the resources are allocated to Pi.
If unsafe Þ Pi must wait, and the old resource-allocation state is restored

No comments:

Post a Comment