A “safe state” is a state such that there is some possible execution sequence following which all the processes can run to completion and deadlock can be avoided. Consequently, system could be in “unsafe state” in which case, there is no deadlock free sequence of resource allocation.
Question #47: Given the data below, which of the following are safe & unsafe states? Resource has 10 instances in total. There are 3 processes which are currently holding “Has” number of resources & in total need “Wants” number of resources to complete execution.
Options:
A) Both State 1 and State 2 are safe states.
B) Both State 1 and State 2 are unsafe states.
C) State 1 is Safe and State 2 is unsafe.
D) State 1 is Unsafe and State 2 is safe.
Solution: In state 1, total allocated resources are 7, making 3 resources freely available. This is enough to cater process B, then process C and finally process A. We cannot find a sequence for State 2. Hence, C is the correct solution.
