A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause.
Two Marks Questions with Answers
Q.1
What is a deadlock ?
Ans. A set of processes is deadlocked if
each process in the set is waiting for an event that only another process in
the set can cause. Usually the event is release of a currently held resource.
Q.2
State the conditions for deadlock.
Four conditions for deadlocks are:
Ans.
:
a.
Mutual exclusion
b.
Hold and wait
c. No preemption
d. Circular wait
1. Atleast one resource must be held in
a nonsharable mode.
2.
A
process holding atleast one resource is waiting for more resources held by
other processes.
3.Resources cannot be preempted.
4.There
must be a circular waiting.
Q.3 What
is deadlock state ?
Ans. If there is any process deadlock in
a state, then that state is called deadlock
state.
Q.4 What
is resource-allocation graph ?
Ans. Deadlocks can
be described more precisely in terms of a directed graph called a system
resource-allocation graph.
Q.5
Is it possible to have a deadlock involving only one process? State your
answer.
Ans. No. This
follows directly from the hold-and-wait condition.
Q.6
List two examples of deadlocks that are not related to a computer system
environment.
Ans. a. Two cars
crossing a single-lane bridge from opposite directions.
b.
A person going down a ladder while another person is climbing up the ladder:
Q7. Define
safe state.
Ans.
A state is safe if the system can allocate resources to each process (up
to its maximum) in some order and still avoid a deadlock.
Q.8 When
is a set of processes deadlocked ?
Ans. Resource deadlock : Each process
requests resources held by another process in the set and it must receive all
the requested resources before it can become unblocked. Communication deadlock:
Each process is waiting for communication from another process and will not
communicate until it receives the communication for which it is waiting.
Q.9
Define request edge and assignment edge.
Ans. There is a request edge from
process P to resource R if and only if P is blocked waiting for an allocation
of R. There is an assignment edge from resource R to process P if and only if P
is holding an allocation of R.
Q.10 What
is hold and wait?
Ans. Hold and Wait :
A process must be holding a resource and waiting for another.
Q.11
What is a knot ?
Ans. A strongly connected sub-graph of a
directed graph, such that starting from any node in the subset it is impossible
to leave the knot by following the edges of the graph.
Q.12
What is banker's algorithm ?
Ans. Banker's
algorithm is a deadlock avoidance algorithm that is applicable to a
resource-allocation system with multiple instances of each resource type.
Q.13 Which
are two options to break a deadlock ?
Ans. There are two
options for breaking a deadlock :
1. Process termination: To abort one or
more processes to break the circular wait.
2. Resource preemption: To preempt some
resources from one or more of deadlock
Q.14 Write
the three ways to deal the deadlock program.
Ans. Three ways to deal with the
deadlock problem :
1.
Use a protocol to prevent or avoid deadlocks, ensuring that the system will
never enter a deadlock state.
2.
Allow the system to enter a deadlock state, detect it and recover.
3. Ignore the
problem altogether and pretend that deadlocks never occur in the system.
Q.15
List out the methods used to recover from the deadlock.
Introduction to Operating Systems: Unit II(b): Deadlock : Tag: : Deadlock - Introduction to Operating Systems - Two marks Questions with Answers
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation