Deadlocks & Livelocks Flashcards

1
Q

Deadlock arises only if what four conditions hold simultaneously?

A
  1. Mutual exclusion
  2. Hold and Wait
  3. No pre-emption
  4. Circular wait
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Mutual Exclusion (mutex) 3 points?

A

There are resources requiring mutual exclusion
* At least one resource held in a non-sharable state
* i.e. Only one process at a time can access the resource
* A requesting process must be delayed until the resource
has been released

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Hold and Wait?

A
  • A process is currently holding (at least one) mutex
    resource
  • And is waiting to acquire (at least one) more that is being
    held by another process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is No Pre-emption?

A
  • Resources cannot be pre-empted
  • Resources can only be released voluntarily by the the
    process holding it.
  • After it has completed its task
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Circular Wait?

A

There exists a chain of processes P1,P2 “, … P3 such that
P1 is waiting for a mutex resource being held by P2.
* P2 for one held by P3
*P2$ for one held by Pn
* Pn for one held by P1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Options for Handling Deadlocks 3 points

A
  1. Ensure the system will never enter a deadlock state
  2. Allow deadlock states, but enable recovery
  3. Ignore the problem and pretend they never occur
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Deadlock Prevention

A
  1. Mutex:
  2. Hold & Wait:
    * Could remove by guaranteeing that when a process requests a
    resource, it does not hold others
    * Required process allocated all its resources before execution
  3. No pre-emption:
    * Could remove: Example – if a process requests a resource but is not
    immediately allocated, it must release all other resources
  4. Circular wait:
    * Could ensure it doesn’t arise: Impose ordering on resource types,
    and processes must request them strictly by this order
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What to avoid Deadlock?

A
  • Prevention ensures cannot exist though limiting
    conditions
  • Avoidance considers resources requirements prior to
    allocation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a safe sate?

A

When a process requests an available resource, the
system must decide if immediate allocation leaves the
system in a safe state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

System is in a safe state if, for processes , P1,P2 “, … P3 what
conditions hold:

A
  • If Pi resource needs are not immediately available, then Pi can wait
    until all Pj(j < i) have finished
  • When Pj” is finished, Pi can obtain needed resources, execute, and return
    allocated resources, and terminate
  • When Pi terminates, P i+1 can obtain its needed resources, and so on.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Safe State and Deadlock Avoidance

A
  • If a system is in a safe state, no deadlocks
  • If a system is in unsafe state, Possibility of Deadlock
  • Avoidance Ensure that a system will never enter an unsafe state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to recover from a Deadlock?

A
  • Two main alternatives:
    Process termination
  • Abort all processes?
  • Abort individual processes until deadlock eliminated

Resource pre-emption
* Which process?
* How to rollback?
* Can cause starvation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Alternative apporach to recovering from a Deadlock?

A
  • Ignore Deadlocks!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly