. Hence request of P, (1, 0, 0) will be granted.
b. Process P, request (1, 0, 0), this request is less)than need, Need for
process P, is (2, 3, 0), Available resource is (1,3, 0) and request is (1, 0, 0).
Request
Que 3.43. | In a system, n processes share m resource units th,
at
can be reserved and released only one at a time. The maximum ng
of each process does not exceed m and sum of all maximum ness!
less than m +n. Show that a deadlock cannot occur. 1)
Answer
n
i Max; 1 for alli
Proof : Need; = Max, — Allocation,
ii, Ifthere exists a deadlock state then :
‘tion of thi,
n
¥ Allocation; = m
ia
Use (i) to get : }; Need;+)) Allocation; = > Max; Available > False
So, system will move to next process.
Need for P, is (110) and available is (310)
Need < Available True
Request for P,is granted.
Available = Available + Allocation
= 310 + 212 =522
Next Process P, needs 501 and available is 522.
Available = 522 + 401 = 923
HOonRNe BS
aNext process p
So, request is granted.
Now Available = 923 + 020 = 943
‘Sts granted 501 < 522, true
3-470 (MCA-Sem,
+2)
—=
4 needs 733 and available is 923.
Next process P; needs (10, 1, 1) and available is 943.
Need > Available
Hence, no sequence is
. aP\<3,3,15
Possible thus the state is unsafe,
Need > Available > 331 ¢ 310
Hence, resource wil] not be granted.
b. P,<2,1,0>
Need < Available > True
210 < 310
Hence, the request will be granted.
Que 3.45, Differentiate between deadlock and starvati jon.
Answer |
Basis for Deadlock Starvation
Comparison|
Basic Deadlock is where no Starvation is where low
protéés proeéeds, and get | priority, processes get
blocked, blocked, and high Priority
Process proceeds,
Arising The occurrence of | Enforcement of priorities,
condition mutual uncontrolled resource
exclusion, hold and wait, no management,
preemption and circular
wait simultaneously.
Other name | Circular wait, Lifelock.
Resources In deadlocked, requested | In starvation, the requested
rreources are blocked by | resources are continuously
the other processes. used by high priority
processes.
Prevention Avoiding mutual exclusion, | Ageing.
hold and wait, and circular
wait and allowing
preemption,
ll