Plattech TP
Plattech TP
Analyze the illustrations below. Then, answer the following items. Search for related literature and/or
relative studies that would support your answers. Cite your references accordingly. (55 points)
1. Describe the deadlock scenario illustrated above based on your understanding. (5 points)
There are 2 process P and Q to compete for resources A and B. Each resource only can
use by 1 process. The process P get and hold the resource B and wait the resource A
available, at the same time the process Q get and hold the resource A while waiting
resource B available. And this condition it cause deadlock because both processes need
use resource A and B at the same time, the process P not willing to let go the resource B
same as the process Q.
2. What do you think would happen if both Process P and Q need to get the same resource? (5
points)
Deadlock is only inevitable if the joint progress of two processes creates a path that
enters the fatal region. A deadlock will most likely occur in this scenario if the two
processes want to get the same resources. As we can see on the diagram, the path 3
and path 4 both leads to the same resources therefore both of them will try to compete
with each other resulting into a deadlock situation.
3. Which concurrency mechanism would you suggest that might prevent the deadlock situation
above? Rationalize your answer. (5 points)
The counting semaphore and the binary semaphore, I believe, has the potential to
prevent deadlock. This form of Semaphore employs a count to aid in the acquisition and
release of tasks several times. If the starting count is zero, a counting semaphore in the
inaccessible state must be generated. It can be used to control access to a given
resource consisting of a finite number of instances. Each process that wishes to use a
resource performs a wait () operation on the semaphore. When the count for the
semaphore goes to 0, all resources are being used. And the process that wish to use a
resource will block until the count becomes greater than 0.
In simpler terms, you lock part of the section for the path 3 to let the path 4 take the
resources and then after the path 4 is done taking resources, path 3 will be release from
its lock state to get the resources or data that it wants to access. With this method, we
can stop the processes into getting in a deadlock state.
Hold and Wait, process can hold a number of resources at a time and at the same time,
it can request for other resources that are being held by some other process. For
example, path 3 can hold two resources A and B and at the same time, it can request
some resource that is currently held by process P4.
6. If you are to implement deadlock prevention before the processes above reach the critical
section, would it be an indirect method or an indirect method? Why? (5 points)
To avoid a deadlock, a direct approach may be preferable. It will prevent the fourth
condition, the cyclic wait, from occurring. The first three requirements are required, but
not sufficient, for an easy deadlock to arise. The fourth criterion is necessary for a
stalemate to occur. It is a possible outcome of the first three requirements. Deadlock
may also be defined as an unsolved cyclic wait, therefore avoiding it directly is
preferable.
7. Which deadlock avoidance approach would you suggest for the given situation above and why?
(5 points)
I would recommend the Resource Allocation Denial, which does not grant an
incremental resource request to a process if it may result in deadlock. Known as the
banker's algorithm. The current distribution of resources to processes is reflected in the
system's state. A safe state is defined as one in which at least one series of resource
allocations to processes does not result in a stalemate. An unsafe condition is one that is
not safe.
8. Would you agree that deadlock is relative to the number of processes and available resources in
an operating system? Why or why not? (5 points)
I agree that the deadlock is dependent on the quantity of processed and accessible
resources in an operating system. A deadlock occurs when a collection of processes is
stalled because one process is holding a resource and waiting for another resource to be
acquired by another process. In multiprocessing systems, parallel computing, and
distributed systems, where software and hardware locks are used to arbitrate shared
resources and perform process synchronization, deadlocks are a prevalent problem.
9. If you are asked to reconstruct the progress diagram above to eliminate the critical section,
which is the deadlock-inevitable region, which aspect(s) or area(s) would you modify? Explain
how the modification eliminates the deadlock. (5 points)
If I were to reconstruct the diagram, I would make it like this to avoid deadlock
I will use alternative logic diagram to prevent the deadlock. Suppose that P does not
need both resources at the same time so that the two processes have this form.
Removing some resource that blocking the way of the path 3 and path 4 will successfully
remove the deadlock. Get A and released A then Get B and released B means changing
the want resource unlike from the first diagram, get A and get B then release A release B
which requiring the resource A before the resource B.
References
Chapter 6 concurrency: Deadlock and starvation - ppt download. SlidePlayer. (n.d.).
Retrieved November 5, 2022, from https://slideplayer.com/slide/5239913/
Singhal, A. (2019, April 26). Akshay Singhal. Gate Vidyalay. Retrieved November 5, 2022,
from https://www.gatevidyalay.com/resource-allocation-graph-deadlock-detection/