Ch. 5 - Deadlock Flashcards

1
Q

Deadlock

A

Permanent blocking of a set of processes that compete for system resources

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

Give an example of deadlock

A

Various Answers

An example: Alex tries to call Will who tries to call Ryrie who tries to call Alex. All people (i.e. processes) are waiting for someone to get off hold (i.e. resource is free)

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

What is the best way to deal with deadlock?

A

It is best to prevent deadlock from happening in your code since there is no efficient general solution to the deadlock problem

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

What are the different categories of resources?

A

> Reusable
Consumable
Preemptable
Non-preemptable

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

Reusable Resources

A

Can be safely used by one process at a time and is not depleted after the process is done using it. (eg. CPU)

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

Consumable Resources

A

Resources that are created and destroyed. When it is acquired by a process, the resource does not exist after the process is done using it. (eg. interrupts)

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

Preemptable Resources

A

Can be taken away from the process owning it with no negative side effects (other than possibly runtime, but correctness is not affected). (eg. CPU)

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

Non-Preemptable Resources

A

Cannot be taken away from process owning it without affecting the process’ correctness. (eg. printer)

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

What categories of resources shared can lead to deadlock occurring?

A

Reusable and Non-Preemptable resources

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

What 4 conditions must hold 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
11
Q

Mutual Exclusion (Condition for Deadlock)

A

Processes do not share resources (one process uses a resource at any given time)

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

Hold and Wait (Condition for Deadlock)

A

Processes may keep some resources while waiting for other resources to become available.

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

No Preemption (Condition for Deadlock)

A

Processes will not give up a resource until it is finished with it.

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

Circular Wait (Condition for Deadlock)

A

Each process in a chain hold a resource requested by another process.

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

Which condition for deadlock is the preferred condition to prevent?

A

Circular Wait. Create systems that prevent, detect, or avoid cycles.

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

Are cycles a sufficient condition for deadlock?

A

No (when dealing with multiple resource units). A cycle is needed for deadlock, but a cycle does not imply deadlock.

17
Q

Knots

A

A cycle with no non-cycle outgoing path from any involved node.

18
Q

What are 4 strategies to deal with deadlocks?

A

> Ignore
Prevent
Avoid
Detect