Professional Documents
Culture Documents
000-097-066
October 3, 2022
CISB 305
Professor Clarke
Assignment 2
1. For each of these conditions— deadlock, race, and starvation—give at least two “real life”
examples (not related to a computer system environment) of each of these concepts. Then
give your own opinion on how each of the six conditions can be resolved.
Answer
Ann Mchoes et al. state that “a deadlock is a system-wide tangle of resource requests that
begins when two or more jobs are put on hold, each waiting for a vital resource to become
available” (McHoes & Flynn, 2018, p. 142). With this in mind, a good example of a deadlock in
real life would be a driver slowing down for a pedestrian, because the driver assumes the
pedestrian wants to cross the road (since the pedestrian has the right of way). Unfortunately, the
pedestrian isn’t sure that the driver is letting them across so instead both the driver and the
pedestrian are waiting for the other to act. The issue can be resolved by the driver signaling to
the pedestrian that they are allowing them across the road. Another example would be two
customers going to Rosalee’s Take Away and Restaurant (Dirty’s) for a chicken snack, due to
customers not being given a receipt and the customers not talking to each other, issues arise.
Both customers stand outside the window assuming the other hasn’t ordered yet so neither one of
the customers ever orders. This issue can be resolved by the staff at Rosalee’s having two
different lines one for ordering and one for pickup, or by the customers asking each other if they
ordered yet. Ann Mchoes et al. also state that a race is “a synchronization problem between two
processes vying for the same resource” (McHoes & Flynn, 2018, p. 165). With this in mind a
good example of a race is a ceiling light in one’s home where it has two light switches on
different ends of the hall, so if the light is off whichever switch is then turned on first, turns the
light on. This can be resolved by using a smart bulb and one switch. Another example would be
two customers at Rosalee’s Take Away and Restaurant ordering at the same time making it
difficult for the staff to hear them and causing the order to be incorrect. This can be corrected by
the customer giving each other enough time to order before the next person orders. Mchoes et al.
state that starvation is “the result of the conservative allocation of resources in which a single job
is prevented from completing its executing because it is waiting for resources that never become
available” (McHoes & Flynn, 2018, p. 165). With this in mind, a good example of starvation is a
customer at Rosalee’s who is demanding and rude to be served by the staff which in turn causes
the other customers not to be served. This can be fixed by rejecting the demanding customer.
Another example is a gentleman holding the door open for a line of women, but as he holds it
open more women show up, thus resulting him in holding the door open for a long period of
time. This can be fixed by the gentleman apologizing and leaving due to his other obligations.
2. Given the ice cream sundae example from the beginning of this chapter, identify which
elements of the deadlock represent the four necessary conditions for this deadlock.
Answer
a. Mutual exclusion: this condition is represented by only one person can eat the ice cream
at a time since only one person can use the soon at a time.
b. Resource holding/Hold-and-wait: this condition is represented by one person having the
ice cream and the other having the spoon.
c. No preemption: this condition is represented by both individuals not wanting to give up
their item (the spoon or the ice cream).
d. Circular wait: this condition is represented by one individual waiting on the other’s
person’s item, the person who has the ice cream wants the spoon, and vice-versa.
3. Using the narrow staircase example from the beginning of this chapter, create a list of actions
or tasks that could be implements by the building manager that would allow people to use the
staircase without risking a deadlock or starvation
Answer
The building manager can do numerous things from implementing rules to making the
stairs wider so that it can properly hold two individuals going in opposite directions. As it
pertains to the rules that can be implemented the following can be implemented:
a. Before taking the steps the landing on each floor can make individuals aware of others
walking up or down the stairs
b. The individual on the landing can then exit the landing once prompted that someone is on
the stairs to avoid blocking the stairs and causing starvation or deadlock.
c. Once no one is on the stairs it can then prompt the individual who exits the landing that
no one is no longer on the stairs.
5. Regarding the role played by the “victim” in deadlock resolution, explain your answers to
these questions.