PT Platech
PT Platech
BSIT - 303
processes getting stuck if they can't get the lock, or using a lot.This is the example of
No Deadlocks so that if we compare the image above and to this illustration thenumber 3 and 4
are not in the deadlock position
2.
What do you think would happen if both Process P and Q
need to get the same resource? (5p o i n t s )
It causes deadlock which both processes cannot progress, and the resources will be destroyed
orconsume after it produce. The categories of this resource fall under the consumable
resources.
3.
Which concurrency mechanism would you suggest that
m i g h t p r e v e n t t h e d e a d l o c k s i t u a t i o n above? Rationalize
your answer. (5 points)
I think the hold and wait, like for example the Process P need to hold at least one resourcesuntil the other process
done or release.
4.
Define in detail the Execution Paths 2 to 6. (5 items x 3
points)Example: Execution Path 1
–
Process Q acquires Resource B and then Resource A.Process
Q then releases Resource B and A, respectively.
1. Q acquires B and then A and then releases B and A. When P resumes execution, it will
be ableto acquire both resources.
2. Q acquires B and then A. P executes and blocks on a request for A. Q releases B and
A.WhenP resumes execution, it will be able to acquire both resources.
3. Q acquires B and then P acquires A. Deadlock is inevitable, because as execution
proceeds, Qwill block on A and P will block on B.
4. P acquires A and then Q acquires B. Deadlock is inevitable, because as execution proceeds,
Qwill block on A and P will block on B.
5. P acquires A and then B. Q executes and blocks on a request for B. P releases A and
B.WhenQ resumes execution, it will be able to acquire both resources.
6. P acquires A and then B and then releases A and B. When Q resumes execution, it will be
ableto acquire both resources
5.
Do Execution Paths 3 and 4 encompass the first
three conditions for a deadlock to occur?Explain your
answer. (5 points)
Yes, the deadlock occurs in the path 3 and 4 because their execution has on the same block so
that itshard to progress both two.
6.
If you are to implement deadlock prevention before the processes
above reach the criticalsection, would it be an indirect method or a
direct method? Why? (5 points)
I would implement or choose the indirect method because it is more flexible than direct
method.Because the direct method possible there are only one condition which is the circular
wait, but in theindirect there are 3 conditions like the mutual exclusion, hold and wait, and No
preemption.
7.
Which deadlock avoidance approach would you suggest for
the given situation above and why?(5 points)
The deadlock avoidance approach that I would suggest in the situation is the resource allocation
denialthis is good for me because it does not grant any other request to process if the allocation
of theresources might lead to deadlock.
8.
Would you agree that deadlock is relative to the number of
processes and available resourcesin an operating system?
Why or why not? (5 points)
Yes, because all the deadlocks involve different resources and processes also. So that it
involvesconflicting resource.
9.
If you are asked to reconstruct the progress diagram above
to eliminate the critical section, whichis the deadlock-
inevitable region, which aspect(s) or area(s) would you
modify? Explain how themodification eliminates the
deadlock. (5 points)
If I reconstruct the progress diagram I would modify the fatal region of the diagram which is
which is inthe gray shaded area, For instance, if P doesn't require simultaneously using both
resources so thatthe two processes take the following form
asdwa