Deadlock Flashcards

(14 cards)

1
Q

What is deadlock?

A

A situation where two or more processes are unable to proceed because each is waiting for a resource held by another process in the group, forming a circular dependency

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

How do we detect deadlock and what can be done if it happens?

A

Grant resources freely and test for deadlock, and if deadlock:

  • Kill all deadlocked processes
  • Kill random processes until cycle broken
  • Take resources from selected processes
  • Restart the process and remove all resources
  • Rollback processes (will probably deadlock again!)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the methods for handling deadlocks?

A
  • Deadlock prevention or avoidance (ensure that the system will never enter a deadlock state)
  • Deadlock detection (allow the system to enter a deadlock state and then recover)
  • Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX
    … ignore the problem and maybe it will go away! If it
    doesn’t - re-boot the machine!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What conditions are needed for deadlock to occur?

A
  • Mutual exclusion
  • Hold and wait
  • No preemption
  • Circular wait
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Mutual Exclusion?

A

Only one process at a time can use a resource

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

How does Mutual Exclusion work?

A

It can’t be used for sharable resources; must hold for non-sharable resources

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

What is Hold and Wait?

A

A process holding at least one resource is waiting to acquire additional resources held by other processes in order to proceed

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

How does Hold and Wait work?

A

It can’t be used for sharable resources; must hold for non-sharable resources

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

What is No Preemption?

A

A resource can be released only voluntarily by the process holding it, after that process has completed its task

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

How does Mutual Exclusion work?

A

It can’t be used for sharable resources; must hold for non-sharable resources

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

What is Circular Wait?

A

There exists a set {P0, P1, …, Pn} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2, …, Pn–1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource that is held by P0.

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

How does Mutual Exclusion work?

A

It can’t be used for sharable resources; must hold for non-sharable resources

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

Do these conditions need each other?

A

These four conditions are not independent. The first three are necessary condition, and the circular wait condition is necessary and sufficient. The circular wait condition incorporates the first three.

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