Os 4 Flashcards

1
Q

What is a deadlock?

A

A deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource held by another process.

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

What are the four necessary conditions for deadlock to occur?

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

What is Mutual Exclusion in the context of deadlocks?

A

At least one resource must be held in a non-sharable mode; only one process can use it at a time.

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

What is Hold and Wait?

A

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

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

What is No Preemption?

A

Resources cannot be forcibly taken away from a process; they must be released voluntarily.

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

What is Circular Wait?

A

A set of processes exists such that each process is waiting for a resource held by the next process in the chain, forming a circle.

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

How can deadlocks be dealt with?

A
  1. Prevention, 2. Avoidance, 3. Detection and Recovery, 4. Ignoring the problem (“ostrich algorithm”).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is deadlock prevention?

A

Designing a system to structurally negate one of the necessary conditions for deadlock.

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

How can Mutual Exclusion be prevented?

A

It is generally difficult since some resources inherently require exclusive access (e.g., printers).

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

How can Hold and Wait be prevented?

A

Require processes to request all resources at once before starting execution, or release all resources before requesting new ones.

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

How can No Preemption be prevented?

A

If a process holding some resources requests another resource that cannot be immediately allocated, it must release its held resources.

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

How can Circular Wait be prevented?

A

Impose a total ordering of all resource types and require that processes request resources in increasing order.

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

What is deadlock avoidance?

A

Dynamically examining resource-allocation state to 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
14
Q

What is a safe state?

A

A state where there is a sequence of all processes such that each process can finish even if all of its requested resources are granted immediately.

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

What is the Banker’s Algorithm?

A

A deadlock avoidance algorithm that allocates resources only if the system will remain in a safe state afterward.

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

What are the requirements of the Banker’s Algorithm?

A

Knowledge of maximum resource needs of each process in advance and ability to check for safe state dynamically.

17
Q

What is deadlock detection?

A

Allowing deadlocks to occur but having a mechanism to detect them and recover.

18
Q

What is a resource allocation graph?

A

A directed graph representing processes and resources; a cycle in this graph indicates a deadlock.

19
Q

How does a deadlock detection algorithm work?

A

It periodically examines the resource allocation graph or uses matrices to detect cycles or unresolvable resource requests.

20
Q

What is deadlock recovery?

A

Taking action to break the deadlock after detection, typically by terminating or preempting processes.

21
Q

What are two methods for deadlock recovery?

A
  1. Process Termination, 2. Resource Preemption.
22
Q

What are the risks of killing processes to recover from deadlock?

A

Possible data loss, inconsistent system state, and difficulty deciding which process to terminate.

23
Q

How can resource preemption break a deadlock?

A

Temporarily removing resources from one or more processes, rolling back their execution, and allowing the deadlocked cycle to be broken.

24
Q

What is the “Ostrich Algorithm” in deadlock management?

A

Choosing to ignore deadlock detection and recovery altogether because deadlocks are very rare and the cost of handling them is high.