edited by
4,066 views
3 votes
3 votes

Suppose there are $4$ processes in execution with $12$ instances of a Resource $R$ in a system.

The maximum need of each process and current allocation are given below :

$\begin{array}{|c|c|c|} \hline \textbf{Process} & \textbf{Max Need} & \textbf{Current} \\  & & \textbf{Allocation} \\\hline \text{$P_1$} & \text{8} & \text{3} \\\hline \text{$P_2$} & \text{9} & \text{4} \\\hline  \text{$P_3$} & \text{5} & \text{2} \\\hline \text{$P_4$} & \text{3} & \text{1} \\\hline \end{array}$

With reference to current allocation, is system safe? If so, what is the safe sequence?

  1. No
  2. Yes, $P_1P_2P_3P_4$
  3. Yes, $P_4P_3P_1P_2$
  4. Yes, $P_2P_1P_3P_4$
edited by

2 Answers

Best answer
3 votes
3 votes
  • P1  holds  3 resources
  • P2 holds 4  resources
  • P3 holds 2  resources
  • P4 holds 1  resource


Total 3+4+2+1 = 10 resources are allocated and 12-10=2 resources are free

  • P1 requires maximum 8 resources; It needs 8-3 =5 more tapes
  • P2 requires maximum 9 resources; It needs 9-4 =5 more tapes
  • P3 requires maximum 5 resources; It needs5-2 =3 more tapes
  • P4 requires maximum 3 resources; It needs 3-1 = 2 more tapes

  
We can allocate 2 free resources to P4. 

P4 will complete execution and release all its resources. Now total 3 resoucres are free. 

We can allocate 3 free resources to P3.

P3 will complete execution and release all its resources. Now total 5 resoucres are free. 

We can allocate 5 free resources to P1.

P1 will complete execution and release all its resources. Now total 8 resoucres are free. 

We can allocate 5 free resources to P2.

P2 will complete execution and release all its resources. 


System is in safe state.!!!

The sequence is P4P3P1P2

Answer C

selected by
Answer:

Related questions

5 votes
5 votes
2 answers
2
go_editor asked Aug 16, 2016
19,731 views
If the Disk head is located initially at track 32, find the number of disk moves required with FCFS scheduling criteria if the disk queue of I/O blocks requests are 98, 3...
3 votes
3 votes
1 answer
3