IT2106
Qencess Mae S. Manalo
COE301
Task Performance
Concurrency and Deadlocks
Objective(s):
At the end of the exercise, the students should be able to:
Assess the common concurrency mechanisms; and
Analyze the deadlock prevention and avoidance strategies as well as the detection approach.
Instructions:
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)
- In my understanding, there is a deadlock inevitable region in execution path 3 and 4. Both
execution needs to gets the same resource at the same time but path 4 don’t want to give
path 3 get the resource.
2. What do you think would happen if both Process P and Q need to get the same resource? (5 points)
- Based on what I read, both Process P and Q it cannot get the same resources at the same
time. Mutual exclusion pertains to the ability to execute all other processes from a course of
04 Task Performance 1 *Property of STI
This study source was downloaded by 100000857096282 from CourseHero.com on 11-14-2022 08:20:57 GMT -06:00
Page 1 of 2
https://www.coursehero.com/file/176664772/Manalo-04-Task-Performance-16-2-1docx/
IT2106
action while one process is granted that ability which means Process P needs time to get
the resource while Process Q needs to wait until the resource is released.
3. Which concurrency mechanism would you suggest that might prevent the deadlock situation above?
Rationalize your answer. (5 points)
- I would suggest Condition Variable to prevent the deadlock situation because it is used to
block a process or thread until specific condition is true. It would prevent the conflict and
threads in deadlock situation.
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.
- Execution Path 2 – Process Q get resource B, then acquires resource A after that, Process P
gets the resource A then followed by B.
- Execution Path 3 – Process Q get resource B, while Process P get resource A. It became
deadlock because Process P get resource A which is needed by Process Q to process.
- Execution Path 4 – Process P acquires Resource A, then Process Q gets the resource B
then became deadlock because Resource B is used by Process Q which is needed by
Process P to process.
- Execution Path 5 – Process P get the resources A and B while Process Q executes and
Process P waits. Process P releases A and B.
- Execution Path 6 – Process P get the resource A and B, then releases Resource A and B
while Process Q waits.
5. Do Execution Paths 3 and 4 encompass the first three conditions for a deadlock to occur? Explain
your answer. (5 points)
- Yes, Execution Paths 3 and 4 encompasses the first three conditions for a deadlock to
occur. The first three conditions are mutual execution, hold on and wait, and no
preemption. If these three conditions didn’t meet the requirements, then there will be no
deadlock. To prevent deadlock, it needs to be eliminated in any of these three conditions.
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’d be implementing deadlock prevention before the processes reach the critical
condition, I would use the direct method because it can be prevented by defining a linear
ordering of resource types. To prevent this, it needs the fourth condition which is the
circular wait.
7. Which deadlock avoidance approach would you suggest for the given situation above and why? (5
points)
- I would suggest Process Initiation Denial Why? Because I does not start a process if it will
lead to 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)
- Yes, I would agree that deadlock is relative to the number of processes and available
resources in an operating system because deadlock it’s a set of processes that had been
blocked by each process by holding a resource and waiting for another resource that
requires other 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. (5 points)
- If I would be reconstructing the progress diagram above to eliminate the critical section, I
would eliminate all pathways that could cause a deadlock to avoid the critical section. With
this, it would be easier to every path to get every resources they need.
References:
https://elms.sti.edu/files/6044561/SCORM_161758663/scormdriver/indexAPI.html
04 Task Performance 1 *Property of STI
This study source was downloaded by 100000857096282 from CourseHero.com on 11-14-2022 08:20:57 GMT -06:00
Page 2 of 2
https://www.coursehero.com/file/176664772/Manalo-04-Task-Performance-16-2-1docx/
IT2106
https://www.geeksforgeeks.org/introduction-of-deadlock-in-operating-system/
https://www.javatpoint.com/os-deadlock-avoidance#:~:text=A%20state%20of%20the%20system,the
%20system%20is%20called%20unsafe
Grading Rubric for Essay:
Criteria Performance Indicator Points
Content Correct ideas, concepts, and/or examples were included. 3
Organization The ideas were presented in an organized manner. 2
TOTAL 5
Note: DO NOT COPY AND PASTE. Students who copy and paste their work from any website or their classmates will automatically receive a failing mark for this assessment task.
04 Task Performance 1 *Property of STI
This study source was downloaded by 100000857096282 from CourseHero.com on 11-14-2022 08:20:57 GMT -06:00
Page 3 of 2
https://www.coursehero.com/file/176664772/Manalo-04-Task-Performance-16-2-1docx/
This study source was downloaded by 100000857096282 from CourseHero.com on 11-14-2022 08:20:57 GMT -06:00
https://www.coursehero.com/file/176664772/Manalo-04-Task-Performance-16-2-1docx/
Powered by TCPDF (www.tcpdf.org)