Safe State in operating systems

What is the state?

The state of the system informs that if resources are allocated to different processes then the 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 an 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 an unsafe state.

Example:

Free resources : 3

PROCESS Allocated R Needed resources
P1 4 10
P2 2 4
P3 2 7

 

Free resources: 1

PROCESS Allocated R Needed resources
P1 4 10
P2 4 4
P3 2 7

 

Free resources: 5

PROCESS Allocated R Needed resources
P1 4 10
P2 0 0
P3 2 7

 

Free resources : 0

PROCESS Allocated R Needed resources
P1 4 10
P2 0 0
P3 7 7

 

Free resources: 7

PROCESS Allocated R Needed resources
P1 4 10
P2 0 0
P3 0 0

 

Free resources: 1

PROCESS Allocated R Needed resources
P1 10 10
P2 0 0
P3 0 0

 

Free resources: 11

PROCESS Allocated R Needed resources
P1 0 0
P2 0 0
P3 0 0

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

Download Slides Presentations and PDF file of this tutorial

  1. Download safe state and unsafe state in OS deadlocks Slides Presentation
  2. Download safe state and unsafe state in OS deadlocks PDF File

Video Lecture

By: Prof. Fazal Rehman Shamil    CEO @ T4Tutorials
Whatsapp: +92 302 87 000 85     Facebook: For Discussions

2 thoughts on “Safe State in operating systems

  • June 27, 2019 at 1:06 pm
    Permalink

    In this blog, we came to know that you are a state of a system is said to be in a safe state is the system can allocate resources to each process in some order by avoiding a deadlock and in an unsafe state operating system cannot prevent processes from requesting resources so the deadlock may occur.

  • June 23, 2019 at 10:23 am
    Permalink

    Here we came to know about the state, safe and unsafe state. The state is what that tells us about the resource allocation to a different process and it leads to deadlock or not. If the system allocates resources by avoiding deadlock then it becomes a safe state. An unsafe state notes a deadlocked state but may lead.

Leave a Reply

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