The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+12 votes
1.7k views

A single processor system has three resource types $X, Y$ and $Z$, which are shared by three processes. There are $5$ units of each resource type. Consider the following scenario, where the column alloc denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Which of these processes will finish LAST?

  alloc request
  $X$ $Y$ $Z$ $X$ $Y$ $Z$
P0 $1$ $2$ $1$ $1$ $0$ $3$
P1 $2$ $0$ $1$ $0$ $1$ $2$
P2 $2$ $2$ $1$ $1$ $2$ $0$
  1. $P0$
  2. $P1$
  3. $P2$
  4. None of the above, since the system is in a deadlock
asked in Operating System by Veteran (59.6k points)
edited by | 1.7k views
+5

..

0

Banker's Algorithm

1 Answer

+22 votes
Best answer

The answer is (C).

Available Resources
$X$ $Y$ $Z$
$0$ $1$ $2$

Now, $P1$ will execute first, As it meets the needs.

After completion, The available resources are updated.

Updated Available Resources
$X$ $Y$ $Z$
$2$ $1$ $3$

Now $P0$ will complete the execution, as it meets the needs.

After completion of $P0$ the table is updated and then $P2$ completes the execution.

Thus $P2$ completes the execution in the last.

answered by Boss (19.7k points)
edited by
0
please explain me how you get "Available Resources" , even if it is not mention in the question  or may be i am not able to fetch that particular point so please help me [email protected]_keeda
+1
Calculate the  total allocated resources.             5  instances of X are allocated                       4 of Y and 3  of Z.

So the available or left resources are      x=5-5=0 :::: y=5-4=1::::z=5-3=2.

Hope it helps.
0
got it thanks ...
0
Plzz explain how p1 will execute first.....as the need of p1 is 022????
0
safe sequence will not be uniqe then how can we conclude that p2 is at last.
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

40,855 questions
47,520 answers
145,895 comments
62,278 users