Last updated on:October 10th, 2018,

Safe State in operating systems

What is a state?

State of the system informs that if resources are allocated to different processes then system undergoes deadlock or not.

What is a safe state?

If the system can allocate resources to the process in such a way that it can avoid deadlock. Then the system is in a safe state.

What is the unsafe state?

If the system can’t allocate resources to the process in such a way that it can avoid deadlock. Then the system is in the safe state.

Example:

Free resources : 3

PROCESSAllocated RNeeded resources
P1410
P224
P327

 

Free resources: 1

PROCESSAllocated RNeeded resources
P1410
P244
P327

[quads id=1]

Free resources: 5

PROCESSAllocated RNeeded resources
P1410
P200
P327

 

Free resources : 0

PROCESSAllocated RNeeded resources
P1410
P200
P377

 

Free resources: 7

PROCESSAllocated RNeeded resources
P1410
P200
P300

 

Free resources: 1

PROCESSAllocated RNeeded resources
P11010
P200
P300

 

Free resources: 11

PROCESSAllocated RNeeded resources
P100
P200
P300

Result: All processes execute successfully, so there is no deadlock and the system is in the safe state.

0Shares

Leave a Reply

Your email address will not be published.