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

04 Task Performance Platform

This document discusses deadlocks that can occur between two processes, P and Q, that are competing for resources A and B. It describes how a deadlock occurs when both processes hold one resource each while waiting for the other resource. Several approaches to deadlock prevention and avoidance are discussed, including resource allocation denial and modifying the progress diagram to eliminate the critical section where deadlocks inevitably occur.

Uploaded by

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

04 Task Performance Platform

This document discusses deadlocks that can occur between two processes, P and Q, that are competing for resources A and B. It describes how a deadlock occurs when both processes hold one resource each while waiting for the other resource. Several approaches to deadlock prevention and avoidance are discussed, including resource allocation denial and modifying the progress diagram to eliminate the critical section where deadlocks inevitably occur.

Uploaded by

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

Ombid,Karl Diosel A.

BSIT 303

TASK PERFORMANCE

1.Describe the deadlock scenario illustrated above based on your understanding. (5 points)

There are two processes, P and Q, competing for the resources A and B in this stalemate scenario. A
process can only use one resource at a time. While waiting for the resource A to become available, the
process P obtains and retains the resource B, while the process Q obtains and holds the resource A while
waiting for the resource B to become available. And this scenario leads to a deadlock since both
processes require the use of resources A and B at the same time, and process P, like process Q, is
unwilling to give up resource B.

2.What do you think would happen if both Process P and Q need to get the same resource? (5 points)

Reusable and consumable resources are the two categories of resources. A reusable resource is one that
may be safely used by more than one process at the same time without becoming exhausted. Resource
units are acquired by processes and then released for use by other processes. Reusable resources
include processors, I/O channels, main and secondary memory, devices, and data structures such as
files, databases, and semaphores.

3.Which concurrency mechanism would you suggest that might prevent the deadlock situation above?
Rationalize your answer. (5 points)

For me, the concurrency mechanism that will prevent deadlock is the Condition Variable concurrency
mechanism, because it is used to block a process or a thread until a specified condition is true, which
means that it will effectively prevent deadlock in the instance above. Another technique is that if a
resource is requested but not available, the system looks to see whether other processes are currently
using those resources and are waiting for something else. If such a process is discovered, some of its
resources may be preempted and added to the list of resources that the process is currently waiting for.
Both of these approaches may be appropriate for resources with readily saved and restored states, such
as registers and memory, but they are rarely appropriate for other devices like printers and tape drives.

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. Process Q get B, get A then release B and after that release A
Process Q get B, get A then the process P want to get A but since Q hold it then have to wait Q finish
then Q Release B and A. Process Q get resource B and the process P get resource A. --> deadlock Process
P get resource A and the process Q get resource B --> deadlock Process P get A and get b, then the
process Q try to get B but since P hold B then wait process P finish

5. Process P get A, get B then release A and after that release Do Execution Paths 3 and 4 encompass
the first three conditions for a deadlock to occur? Explain your answer. (5 points)

Process Q obtains resource B, while Process P obtains resource A, resulting in a stalemate on path 3.
Process P obtains resource A, while Process Q obtains resource B, resulting in a deadlock on path 3. As
detailed here, the execution routes for 3 and 4 include three requirements before reaching a deadlock.
It's up to you whether you find the 3 or 4 deadlock path, because they both contain three requirements.
Ombid,Karl Diosel A.
BSIT 303

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)

If I want to prevent a deadlock before the processes reach the critical area, I'll use the Direct method
since, as we all know, it prevents the fourth condition from occurring, and I'll utilize Circular wait, which
will make the process easier. 7.Which deadlock avoidance approach would you suggest for the given
situation above and why? (5 points) The Deadlock avoidance approach that I might suggest in the figure
above is Resource allocation denial because this will not grant an incremental resource request to a
process if this allocation might lead to a deadlock because we all know that the situation above might
have three conditions before it leads to a deadlock.

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)

In my opinion, deadlock is proportional to the number of processes and available resources in an


operating system because, as we all know, there are some multitasking processes and conditions that
must be met before a deadlock can occur, and there is an option to wait for available resources before
proceeding to the deadlock.

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 had the opportunity to reconstruct the process diagram above to remove the critical section, the only
thing I would remove is the path that will make the process complicated or critical, such as the area
where P and Q want A and P and Q want B on the table above. This will reduce the conditions and make
the path easier.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy