Resource Request Algorithm

Q1. Explain Resource Request Algorithm.

Ans. Following is the method of Resource Request Algorithm:

For process Pi

request=request vector for process Pi

 

If Request[i]=k

then

processes Pi wants k instances of resource type Rj.

  1. If Requestj ≤ needi

then

go to step 2.

otherwise,

error condition.

  1. If Requestj ≤ Available

then

go to step3

otherwise

Pi must wait, because resources are not available.

  1. To allocate requested resources to Pi by modifying the state as follow:

 

Available = Available – Requestj

Allocation = Allocationj + Requestj

needi = needi – Requestj

 

If safe the resource are allocated to Pi.

If unsafe Pi must wait, and the old resource allocation state is restored.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: