You are on page 1of 2

ALVARADO, XAVIER XEB

BSIT 2A

11/16/22

TASK PERFORMANCE

CONCURRENCY AND DEADLOCKS

1. P and Q are competing for A and B's resource, as shown in the figures. Among those assets, The P and
Q processes are the only ones who can use it. P obtains and holds resource B, while awaiting the
availability of resource A. As a result of this scenario, both operations require the usage of use of
resources A and B at the same time, and process P, like process A, is serious about keeping resource B,
as well as process Q.

2. When process P sends a signal to process Q to wake up, P waits for Q to exit the monitor or for some
other condition to happen.

3. Eliminate Mutual Exclusion is impossible to dissatisfy since some resources, such as the tape drive and
printer, are naturally non-shareable.

4. Process Q takes B, obtains A, and then releases B, followed by A. Process Q get B, get A then the
process P wants to get A, but because Q is holding it, it must wait for Q to finish before Q releases B and
A. Process Q gets resource B, while process P takes resource A.--> deadlock Process P acquires resource
A, as Process Q obtains 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 Process P get A, get B then release A and after that
release B

5. The execution path of 3 and 4 encompass the first three conditions, which are mutual exclusion, hold
and wait, and no preemption. If any of these requirements are not met, there will be no deadlock. As a
result, we begin by considering methods for preventing deadlock, each of these techniques seeks to
prevent one of the conditions from happening, and so is one means of resolving the deadlock issue.

6. If I will be implementing deadlock prevention before the process reaches the critical section, I think I
might choose an indirect method because the purposes of deadlock prevention, a system can be
modeled as a collection of limited resources, which can be partitioned into different categories to be
allocated to a number of processes each having different needs.

7. Safe and Unsafe States. Any resource request in a deadlock-avoidance system will be granted if the
system's resulting state does not cause deadlock. The state of the system will be checked on a regular
basis for safe and unsafe situations. The simplest and most practical technique is for the process to
declare the maximum quantity of each type of resource that it may ever require. The deadlock
avoidance technique keeps track of resource allocations to guarantee that a continuous wait condition
does not develop.

8. Yes, since deadlocks are a collection of blocked processes, each of which is holding a resource and
waiting to acquire a resource held by another process, which is waiting for a resource held by another
process.

9. If I will task to reconstruct the progress diagram above, I'd prefer to eliminate any pathways that
would result in a conflict since they will make the process more difficult or critical. Just like the P and Q
that are competing for the B resources. Following the conclusion, I will remove the processes P and Q to
avoid any conflicts within the threads and processes, effectively reducing the conditions and making it
simpler for other pathways to reach their appropriate destinations.

You might also like