FmD4FRX3FmXvDZXvGZT3FRFgNBP1w326w3z1NBMhNV5=
items

CS604 Assignment 3 Solution

 CS604 Assignment 3 Solution


CS604 Assignment 3 Solution

NOTE:  Please don’t copy paste

Q1.  Suppose following  number of processes along with resources instance currently running in a system.

 

·         P= { P1, P2, P3, P4, P5}

·         R = { R1, R2, R3, R4, R5 }

Resource Instances

·         2 instance of resource type R1

·         2 instances of resource type R2 

·         1 instance of resource type R3 

·         1 instance of resource type R4

·         1 instance of resource type R5

Process States 

·         Process P1 is holding 1 instance of resource R1, and is waiting for an instance of resource R2.

·          Process P2 is holding an instance of resource R2 and R3, and is waiting for an instance of resource R4. 

·         Process P3 is holding 1 instance of resource R2 and waiting for an instance of resource R1 and R5.

·         Process P4 is holding  1 instance of resource R5 and R1, and also waiting for an instance of resource R3.

·         Process P5 is holding 1 instance of  R4 and waiting for for an instance of resource R1.

Considering the above system states

 

You are required to draw the Resource Allocation Graph and state that either system is in safe state or not. Briefly justify your answer.

 


Solution:

Resources Allocation Graph

CS604 Assignment 3 Solution virtual university of pakistan



System is not in safe mode

Explanation:

As showed in graph that all the resources are allocated to different processes and all processes still requesting some other recourses so we assume that the system Is not in safe mode .

Deadlock is an substate of unsafe mode so as this system in unsafe mode so it’s possible that may be deadlock  condition there

If some processes are not waiting for other resources them may be possible that after some time system becomes safe when those processes done there work and release allocated resources .

 


 

Question No. 2                                                                                                                       05 Marks   

Suppose a system with 18 tape drives and 4 processes. The current system state is shown in the following table.

Process

Max Need

Allocated

Available

P0

13

5

2

P1

8

6

 

P2

16

2

 

P3

18

3

 

 

 

A.     By using the deadlock avoidance algorithm to find out that either the system is in a safe state or not, when considering the request of all processes. Fill the Available column in given table.

B.     If the system is in a safe state, then write down the safe sequence and if the system is not in a safe state, then give a reason to support your answer.

 

Solution:

A.

Process

Max Need

Allocated

Available

P0

13

5

2

P1

8

6

 8

P2

16

2

13

P3

18

3

 

 

                                                                      Safe<P1,P0>

B.

System is not in safe state  because after the sequence of p1 and p0 available plates are not enough to allocate any other process as for p2 14 palates are needed while available plates are 13 and for p3 there is a need of 15 plates while available plates are not enough to full fill that demand so system is not in safe state .

Condition :

Process

Max Need

Allocated

Available

P0

13

5

2

P1

8

6

 8

P2

16

3

13

P3

18

2

16








Click Below to download in word file👇

cs604 assgment soltion 2022 by vu

Cs604 whatsapp Groups 👇👇👇


Cs604 whatsapps Grpups links




0/Post a Comment/Comments

Partner

73745675015091643