1

In Operating System Concepts:

7.5.1 Safe State

A state is safe if the system can allocate resources to each process (up to its maximum) in some order and still avoid a deadlock. More formally, a system is in a safe state only if there exists a safe sequence. A sequence of processes <P 1 , P 2 , ..., P n > is a safe sequence for the current allocation state if, for each P i , the resource requests that P i can still make can be satisfied by the currently available resources plus the resources held by all P j , with j < i. In this situation, if the resources that P i needs are not immediately available, then P i can wait until all P j have finished.

A safe state is not a deadlocked state. Conversely, a deadlocked state is an unsafe state. Not all unsafe states are deadlocks, however (Figure 7.6).

enter image description here

  1. Is starvation also a property of a system state, just as safe/unsafe and deadlock are?

  2. Does a safe state not lead to a starvation state, just as a safe state does not lead to a deadlock state? (So can we use deadlock avoidance strategies to avoid starvation?)

  3. What strategies are used for avoiding starvation?

Thanks.

1 Answer 1

4

A given process order is safe if the system is able to allocate resources to each successive process without the possibility of deadlock. Starvation is when a given process fails to execute because different processes are selected (typically due to process priorities).

Fundamentally, seeking a 'safe state' asks if there is a viable order in which processes can be executed. Starvation happens when restrictions are placed on the set of viable process orders (p1 should always execute when there are sufficient resources).

  1. Starvation can be considered more of a 'user error' rather than a deadlock. It means there are sufficient resources to allocate to the next process, but the selected next process is less desirable. Assuming a fixed number of total processes, eventually it will run.
  2. Deadlock is distinct from starvation. In deadlock, another process can't continue. Starvation means it could continue, but another process is going instead.
  3. To avoid starvation process priorities can be tweaked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.