• edited by
5,075 views
3 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$

2 Answers

Best answer
3 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:
Position:
Show:

Related questions

6 6 votes
2 answers 2 answers
2.8k
2.8k views
go_editor asked Aug 16, 2016
2,817 views
A scheduling Algorithm assigns priority proportional to the waiting time of a process. Every process starts with priority zero (lowest priority). The scheduler reevaluate...
5 5 votes
2 answers 2 answers
22.1k
22.1k views
go_editor asked Aug 16, 2016
22,068 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 3 votes
1 answers 1 answer
9.9k
9.9k views
go_editor asked Aug 16, 2016
9,922 views
Consider the reference string:0 1 2 3 0 1 4 0 1 2 3 4If FIFO page replacement algorithm is used, then the number of page faults with three page frames and four page frame...
3 3 votes
1 answers 1 answer
3.7k
3.7k views
go_editor asked Aug 16, 2016
3,716 views
Which of the following is not typically a benefit of dynamic linking?Reduction in overall program execution timeReduction in overall space consumption in memoryReduction ...