0% found this document useful (0 votes)
6 views2 pages

A

The document outlines the resource allocation and availability in a system with four resources (A, B, C, D) and five processes (P1 to P5). It calculates the available resources and the need matrix for each process, concluding that a safe sequence exists for execution. Additionally, it discusses a resource request from P1 that cannot be approved due to exceeding the maximum need for resource C.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

A

The document outlines the resource allocation and availability in a system with four resources (A, B, C, D) and five processes (P1 to P5). It calculates the available resources and the need matrix for each process, concluding that a safe sequence exists for execution. Additionally, it discusses a resource request from P1 that cannot be approved due to exceeding the maximum need for resource C.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

A.

- The total resources of the system are A = 9, B = 8, C = 7, and D = 6.


- The number of resources allocated to :
A is 2+0+1+2+0=52+0+1+2+0=5.
B is 0+1+1+0+2=40+1+1+0+2=4.
C is 1+1+1+1+0=41+1+1+1+0=4.
D is 1+1+1+1+1=51+1+1+1+1=5.
=>
Available A = 9 - 5 = 4
Available B = 8 - 4 = 4
Available C = 7 - 4 = 3
Available D = 6 - 5 = 1
- The Available matrix: [4,4,3,1][4,4,3,1].
- Full Need Matrix:
Need P1 = Max P1 - Allocation P1 = (6, 4, 1, 1) - (2, 0, 1, 1) = (4, 4, 0, 0)
Need P2 = Max P2 - Allocation P2 = (7, 5, 6, 2) - (0, 1, 1, 1) = (7, 4, 5, 1)
Need P3 = Max P3 - Allocation P3 = (5, 2, 5, 1) - (1, 1, 1, 1) = (4, 1, 4, 0)
Need P4 = Max P4 - Allocation P4 = (4, 2, 3, 1) - (2, 0, 1, 1) = (2, 2, 2, 0)
Need P5 = Max P5 - Allocation P5 = (7, 4, 5, 2) - (0, 2, 0, 1) = (7, 2, 5, 1)
Proces
A B C D
s
P1 4 4 0 0
P2 7 4 5 first
P3 4 first 4 0
P4 2 2 2 0
P5 7 2 5 first
Based on the calculated Available and Need matrices, we can see that a safe sequence can
be found as follows: P1 → P3 → P2 → P4 → P5. This ensures that each process can
receive enough resources, execute, complete its work, and return the resources, which can
then be reused by subsequent processes in the chain.
B.
P1 is requesting additional resources as (1,0,2,0).
 P1's need for A (1) is lower than or equal to P1's need for A (4), so it can be
satisfied.
 P1's need for B (0) is lower than or equal to P1's need for B (4), so it can be met.
 P1's demand for C(2) is higher than P1's need for C(0), which cannot happen
because P1 does not need additional C resources.
 P1's need for D(0) is less than or equal to P1's need for D(0), so it does not cause a
problem.
P1's request exceeds the required amount of resource C that P1 needs (request 2 but Need
only has 0). Therefore, this request cannot be approved because it exceeds the maximum
request that P1 can have.
=> request (1,0,2,0) of P1 cannot be approved.

You might also like