Deadlocks Flashcards

(73 cards)

1
Q

What is a deadlock?

A

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.

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

In the example of deadlocks, what do processes P1 and P2 hold and need?

A

Each holds one disk drive and each needs another one.

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

What is a process considered if it is waiting for an event that will never occur?

A

A process is deadlocked.

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

What does it mean for a process to be indefinitely postponed?

A

A process is delayed repeatedly over a long period while attention is given to other processes.

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

What are the types of resource models mentioned?

A

Resource types R1, R2, …, Rn with each resource type Ri having Wi instances.

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

What are the four necessary conditions for a 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
7
Q

What is mutual exclusion in the context of deadlocks?

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
8
Q

What does ‘hold and wait’ mean?

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
9
Q

What is the no preemption condition?

A

A resource can only be released voluntarily by the process holding it.

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

Define circular wait.

A

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

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

What is a Resource-Allocation Graph?

A

A set of vertices V and a set of edges E, partitioned into processes and resource types.

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

What are the two types of edges in a Resource-Allocation Graph?

A
  • Request edge: directed edge Pi → Rj
  • Assignment edge: directed edge Rj → Pi
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If a Resource-Allocation Graph contains no cycles, what does this imply?

A

No deadlock.

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

What happens if a graph contains a cycle with only one instance per resource type?

A

Deadlock occurs.

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

What is one method for handling deadlocks?

A

Ensure that the system will never enter a deadlock state.

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

What does deadlock prevention involve?

A

Designing the system to ensure that at least one of the necessary conditions cannot hold.

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

What is deadlock avoidance?

A

The system dynamically considers every request and decides whether it is safe to grant it.

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

What does deadlock detection entail?

A

Allowing the possibility of deadlock and determining if it has occurred and which processes and resources are involved.

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

What is recovery in deadlock management?

A

Clearing the problem after detection, allowing processes to complete and resources to be reused.

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

What is the implication of denying any one of the conditions for deadlock?

A

Deadlock is impossible.

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

What does the hold and wait condition guarantee?

A

When a process requests a resource, it does not hold other resources.

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

What is the outcome of forcing each process to acquire all required resources at once?

A

Low resource utilization and possible starvation.

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

How does no preemption apply to deadlock prevention?

A

Preempt resources from a process and add them to the list of resources for which the process is waiting.

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

What is the purpose of imposing a total ordering of all resource types?

A

To prevent circular wait.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is the Banker’s Algorithm used for?
Used for multiple instances of each resource type.
26
What does the safe state mean in the context of deadlock avoidance?
The system is in a safe state if there exists a sequence of all processes such that resources can be satisfied.
27
What happens when the system is in an unsafe state?
There is a possibility of deadlock.
28
What is the significance of a claim edge in the Resource-Allocation Graph?
Indicates that process Pi may request resource Rj.
29
What occurs when a resource is released by a process?
The assignment edge reconverts to a claim edge.
30
What is the requirement for resource requests in the system?
Resources must be claimed a priori.
31
What is a key idea behind deadlock avoidance?
The system will allocate a resource immediately only if the resulting state is still safe.
32
What does assignment not result in within the resource allocation graph?
The formation of a cycle
33
What is the outcome of a safe state in the resource allocation graph?
The system remains in a safe state
34
What is the purpose of the Banker's Algorithm?
Used for multiple instances of each resource type
35
What must a new process declare when it enters the system?
The maximum number of instances of each resource type it may need
36
What does the OS check when a process requests a resource?
If the allocation leaves the system in a safe state
37
What happens if the allocation does not leave the system in a safe state?
The process must wait
38
What must a process do when it has received all its resources?
Return them in a finite amount of time
39
What is the structure of the 'Available' data in the Banker's Algorithm?
Vector of length m, indicating available instances of each resource type
40
What does Max represent in the Banker's Algorithm?
An n × m matrix indicating the maximum instances of each resource type a process may request
41
What does Allocation indicate in the Banker's Algorithm?
An n × m matrix showing currently allocated instances of each resource type to processes
42
What does Need represent in the Banker's Algorithm?
An n × m matrix indicating the remaining resources needed by each process to complete its task
43
What is the formula for calculating Need?
Need[i,j] = Max[i,j] - Allocation[i,j]
44
What do Work and Finish vectors represent in the Safety Algorithm?
Work is a vector of available resources; Finish indicates if a process can finish
45
What is the first step in the Safety Algorithm?
Initialize Work to Available and Finish[i] to false for all processes
46
When does the system enter a safe state according to the Safety Algorithm?
If Finish[i] = true for all processes
47
What is an example of a process sequence that satisfies safety criteria?
< P1, P3, P0, P2, P4 >
48
What is Request[i] in the Resource-Request Algorithm?
The request vector for process P_i indicating how many instances of each resource type are requested
49
What condition must be satisfied for a process request to be valid?
Request[i] ≤ Need[i]
50
What happens if Request[i] is less than or equal to Available?
Proceed to allocate resources
51
What is the consequence if a process requests resources that lead to an unsafe state?
The old resource-allocation state is restored
52
What is the purpose of the deadlock detection algorithm?
To examine the system state and determine if a deadlock has occurred
53
What is a wait-for graph in deadlock detection?
A graph that represents processes waiting for other processes
54
How often should the deadlock detection algorithm be invoked?
Every time a request for allocation cannot be granted immediately
55
What are the two options to recover from deadlock automatically?
* Abort one or more processes * Preempt some resources from one or more deadlocked processes
56
What is a potential issue with aborting processes to resolve deadlock?
It may be expensive as processes might have computed for a long time
57
What is the runtime complexity of the cycle detection algorithm in a graph?
O(n^2)
58
What happens if the finish condition is false for some process in the deadlock detection algorithm?
The system is in a deadlock state
59
What is the relationship between Need and Allocation in the context of resource requests?
Need indicates how many more instances are required to complete the task
60
What is the state of the system if resources can be reclaimed but are insufficient for other processes?
Deadlock exists
61
What is the impact of arbitrary invocation of the deadlock detection algorithm?
It may lead to many cycles in the resource graph, complicating detection
62
What is the definition of a safe state?
A state where processes can finish without causing a deadlock
63
What is the significance of maintaining the necessary information for deadlock detection?
It incurs runtime costs
64
Fill in the blank: The Banker's Algorithm is used for _______ instances of each resource type.
multiple
65
What is the overhead associated with eliminating deadlock cycles?
Overhead occurs because a deadlock-detection algorithm must be invoked after each process is aborted to determine if any processes are still deadlocked. ## Footnote Deadlock-detection algorithms can add significant processing time and resource consumption.
66
What must the OS do if a process is aborted while it is in the middle of printing/updating a file?
The OS must reset the values before proceeding with the next request. ## Footnote This ensures data integrity and consistency in the file being accessed.
67
What factors should be considered while terminating processes to eliminate deadlocks?
* Priority of the processes * Number and types of resources used/required * Foreground or background process * Execution time and remaining time to complete the task ## Footnote These factors help in making informed decisions on which processes to terminate.
68
What is resource preemption in the context of deadlock elimination?
Resource preemption involves taking some resources away from certain processes and giving them to other processes until the deadlock cycle is broken. ## Footnote Preemption can help to resolve resource contention and allow processes to continue executing.
69
What issues need to be addressed when preempting resources to eliminate deadlocks?
* Selecting a victim: Which resources and processes to preempt? * Rollback: What to do with the preempted process? * Starvation: How to ensure resources are not always preempted from the same process? ## Footnote Each issue requires careful consideration to minimize negative effects on system performance.
70
How can a victim be selected for resource preemption?
Select the one that minimizes the cost, considering parameters like the number of resources held and how long the process has computed. ## Footnote This strategy aims to reduce the overall impact of resource preemption on system efficiency.
71
What are the two solutions for handling a process after its resources have been preempted?
* Rollback the process from a safe state (overhead added to OS) * Total rollback (abort the process and then restart it) ## Footnote Rollback strategies are critical for maintaining the integrity of the system during preemption.
72
What is starvation in the context of process management?
Starvation occurs when resources are always preempted from the same process, preventing it from progressing. ## Footnote This can lead to indefinite waiting for certain processes, impacting overall system performance.
73
What solution can be implemented to avoid starvation during resource preemption?
Include the number of rollbacks in the cost factor while selecting the victim. ## Footnote This helps ensure that processes do not suffer from repeated preemption, allowing them a fair chance of resource access.