Let me know if i m wrong...

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+1 vote

A number of processes could be in a deadlock state if none of them they execute due to non-availability of sufficient resources. Let $P_i, 0 \leq i \leq 4$ represent five processes and let there be four resources types $r_j, 0 \leq j \leq 3$. Suppose the following data structures have been used.

**Available:** A vector of length 4 such that if Available $[i]=k$, there are k instances of resource type $r_j$ available in the system.

**Allocation. **A 5 $\times$ 4 matrix defining the number of each type currently allocated to each process. If Allocation $[i,j]=k$ then process $p_i$ is currently allocated $k$ instances of resource type $r_j$.

**Max.** A 5 $\times$ 4 matrix indicating the maximum resource need of each process. If $Max[i,j]=k $ then process $p_i$, may need a maximum of $k$ instances of resource type $r_j$ in order to complete the task.

Assume that system allocated resources only when it does not lead into an unsafe state such that resource requirements in future night cause a deadlock state. Now consider the following snapshot of the system.

$$\textbf{Allocation}$$ | ||||

r0 | r1 | r2 | r3 | |

$p_0$ | 0 | 0 | 1 | 2 |

$p_1$ | 1 | 0 | 0 | 0 |

$p_2$ | 1 | 3 | 5 | 4 |

$p_3$ | 0 | 6 | 3 | 2 |

$p_4$ | 0 | 0 | 1 | 4 |

$$\textbf{Max}$$ | |||

r0 | r1 | r2 | r3 |

0 | 0 | 1 | 2 |

1 | 7 | 5 | 0 |

2 | 3 | 5 | 6 |

0 | 6 | 5 | 2 |

0 | 6 | 5 | 6 |

$$\textbf{Available}$$ | |||

r0 | r1 | r2 | r3 |

1 | 5 | 2 | 0 |

Is the system currently in a safe state? If yes, explain why.

- All categories
- General Aptitude 1.3k
- Engineering Mathematics 5.2k
- Digital Logic 2k
- Programming & DS 3.7k
- Algorithms 3.2k
- Theory of Computation 4k
- Compiler Design 1.6k
- Databases 3k
- CO & Architecture 2.6k
- Computer Networks 3k
- Non GATE 1k
- Others 1.3k
- Admissions 486
- Exam Queries 435
- Tier 1 Placement Questions 18
- Job Queries 56
- Projects 9

36,187 questions

43,631 answers

124,057 comments

42,905 users