0% found this document useful (0 votes)
121 views

Task Performance Concurrency & Deadlocks

The document discusses deadlocks that can occur when multiple processes are competing for limited system resources. It describes a scenario where two processes, P and Q, are attempting to acquire resources A and B, but only one process can use each resource at a time, resulting in a deadlock situation. The document then asks questions about defining execution paths in a joint progress diagram, identifying conditions for deadlock, and approaches for deadlock prevention and avoidance.

Uploaded by

Elijah Riley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views

Task Performance Concurrency & Deadlocks

The document discusses deadlocks that can occur when multiple processes are competing for limited system resources. It describes a scenario where two processes, P and Q, are attempting to acquire resources A and B, but only one process can use each resource at a time, resulting in a deadlock situation. The document then asks questions about defining execution paths in a joint progress diagram, identifying conditions for deadlock, and approaches for deadlock prevention and avoidance.

Uploaded by

Elijah Riley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TASK PERFORMANCE

CONCURRENCY AND DEADLOCKS

1. Describe the deadlock scenario illustrated above based on your understanding.


A deadlock is the inability of several processes to interact or compete for system resources
without being permanently immobilized. An event that can only be started by another set of
stopped processes is expected, thus a group of processes are blocked in anticipation of it. There
is no efficient method to end the impasse, which will remain in place forever. Two processes, P
and Q, compete for the resources, A and B. Only one process at a time can use each resource.
Because both processes are required by this condition, there is a deadlock.
2. What do you think would happen if both Process P and Q need to get the same resource?
The joint progress diagram can be used to view the history of resource-sharing between two
processes. It would be required to use a higher-dimensional picture if there were more than
two processes vying for the same resource. The concepts of impasse and dangerous zones
would not alter.
3. Which concurrency mechanism would you suggest that might prevent the deadlock
situation above?
The utilization of semaphore when the connection with a waiting queue may result in satiation,
in which two additional processes wait eternally for an event that can only be triggered by one
of the waiting processes. When this happens, the process is deadlocked. The counting
semaphore and the binary semaphore, I believe, have the potential to prevent deadlock. This
form of Semaphore employs a count to aid in the acquisition and release of tasks several times.
When the count for the semaphore goes to 0, all resources are being used.
4. Define in detail the Execution Paths 2 to 6.
For resources A and B, processes P and Q face off. Only one process may use each resource at a
time. Process P obtains, holds, and waits for Resource B while obtaining and holding Resource
A. Because neither process is willing to relinquish resource A at the same moment, this scenario
results in stalemate. We occasionally also employ the Joint Progress Diagram to show how two
processes are battling for the same resource. Six paths of the processes Q and P receive
resources are shown in the joint progress diagram:

Path 2: Q obtains B before obtaining A. Following a request for A, P executes and stops. Q
discharges B and A. P will be able to acquire both resources when it restarts execution.
Path 3: Q gains B, and subsequently P gains A. Deadlock is unavoidable because as far as the
Path 4: P obtains A, followed by Q obtaining B. Because
Path 5: P acquires A and then B as it is being executed, deadlock is unavoidable. A request for B
is handled by Q, who then delays. P frees up A and B. Q will not be able to obtain both
resources when it restarts execution.
Path 6: P purchases A, then B, and finally both A and B. when Q begins to run again.
5. Do Execution Paths 3 and 4 encompass the first three conditions for a deadlock to occur?
Explain your answer.
The gray-shaded area in the figure above refers to the commentary on paths 3 and 4. If an
execution path enters this fatal region, then deadlock is inevitable. Deadlock is only inevitable if
the joint progress of the two processes creates a path that enters the fatal region.
6. If you are to implement deadlock prevention before the processes above reach the critical
section, would it be an indirect method or a direct method? Why?
Systems are created to guarantee that at least one of the four prerequisites for deadlock is
disregarded. Defined as an unresolved cyclic wait, deadlock is something that is best avoided
directly. Although the first three conditions must be met, they are insufficient to prevent a
simple impasse.
7. Which deadlock avoidance approach would you suggest for the given situation above and
why?
I advise using the Resource Allocation Denial, which refuses to grant a process an incremental
resource request if it might cause a deadlock. In order to prevent reaching the deadlock point,
this technique provides for the three conditions that must exist for a stalemate to occur. In
comparison to avoidance detection, it supports more concurrent operations.
8. Would you agree that deadlock is relative to the number of processes and available
resources in an operating system? Why or why not?
When a group of processes becomes stuck while one is holding onto a resource and another is
awaiting its acquisition by another process, it is said to be in a deadlock. The system is
considered to be in a deadlock when a process cannot modify its state indefinitely because the
resources it needs are being used by another waiting process.
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.

Contrary to the first diagram, get A and get B then release A release B means changing the
desired resource. Get A and get B then release A release B. The impasse can be resolved by
taking away a resource that is impeding the movement of resources via paths 3 and 4.

You might also like