Chapter 5 : Deadlock In ICS Flashcards

1
Q

How are System Resource Structured in a multi-thread system?

A
  1. Systems consists of finite resources distributed among competing threads
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are resources partitioned into?

A
  1. Partitioned into types ( CPU , Network Interface )
  • Each type has multiple identical instances ( 4 CPU , 2 Network Interface )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the typical sequence for a thread when ultilizing system resources?

A
  1. Request → Use → Release
  • Thread first request for a resource, then uses it, then release the resource when it was finished
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How are resource requests typically implemented in operating systems?

A
  1. Request / Release Device
  2. Open/ Close File
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When does deadlock occurs?

A
  1. Occurs when threads wait for resources held by each other
  • Situation in concurrent systems ( OS with multiple threads or processes ) where 2 or more threads are permanently blocked, waiting each other to release resources
  • Example
    • Two people trying to cross a narrow bridge from opposite sides and they wait at the middle, which is also a deadlock
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List out 2 synchronization tools for Deadlock

A
  1. Mutex Locks
  2. Semaphores
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does Synchronization Tools do to avoid deadlocks?

A
  1. Properly managing resource acquistion and release is crucial to avoid deadlocks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List out 4 conditions that is necessary for deadlock to occur

A
  1. Mutual Exclusion
  2. Hold and Wait
  3. No Pre-emption
  4. Circular Wait
  • All 4 condition must be present sumultaneously for a deadlock to occur
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the condition for Mutual Exclusion?

A
  1. At least one resource must be non-sharable ( Only one thread can use it at a time )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the condition for Hold and Wait?

A
  1. A thread holding at least one resource is waiting to acquire additional resources held by other threads
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the condition for No Pre-emption?

A
  1. Resources cannot be forcibly taken away from a thread; they must be released voluntarily
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the condition for Circular Wait?

A
  1. A st of waiting threads exists where each thread is waiting for a resource held by the next thread in the set, forming a cycle
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a resource allocation graph?

A
  1. A system resource-allocation graph is a directed graph used to represent the allocation of resources to threads
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

List out 2 components of Resource-Allocation Graph

A
  1. Vertices ( Graph Components )
  2. Edges ( Graph Directions )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

List out 2 types of Vertices

A
  1. T
    • Set of all active Threads
  2. R
    • Set of all Resource types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

List out 2 types of Edges

A
  1. Request Edge ( T → R )
    • Thread Ti requests an instance of resource type Rj
  2. Assignment Edge ( R → T )
    • Resource type Rj is allocaed to thread Ti
17
Q

What are thread represented as in Resource Allocation Graph? ( Shape )

18
Q

What are Resource represented in Resource Allocation Graph ? ( Shape )

19
Q

How to see if there is no deadlock in the graph?

A
  1. If there is no cycle in the graph, no threads are deadlocked
20
Q

How to view if there is a deadlock in the Resource Allocation Graph?

A
  1. With exactly one instance per resource type, deadlock occured
  2. With multiple instanced per resource type, deadlock may or may not occur
21
Q

List out 3 main approached for handling deadlocks

A
  1. Ignore the Problem
  2. Prevent or Avoid Deadlocks
  3. Detect and Recover
22
Q

What methods for handling deadlocks is common in most OS?

A
  1. Ignore the Problem ( Linux, Windows )
23
Q

What methods for handling deadlocks relies on developers to handle deadlocks?

A
  1. Ignore the Problem
24
What methods for handling deadlocks are cost-effective and simpler?
1. Ignore the Problem
25
What methods for handling deadlocks creates protocols to ensure the system never enters a deadlocked state?
1. Prevent or Avoid Deadlocks
26
List out 2 methods inside Prevent or Avoid Deadlocks
1. Deadlock Prevention 2. Deadlock Avoidance
27
What mathods for handling deadlocks is common in systems like databases?
1. Detect and Recover
28
What methods of handling deadlocks allow deadlocks, detect them, and then recover?
1. Detect and Recover
29
What does Deadlock Prevention ensures?
1. Ensures that at least one of the necessary conditions for deadlock cannot hold * Necessary Conditions 1. Mutual Exclusion 2. Hold and Wait 3. No Pre-emption 4. Circular Wait
30
What does Deadlock Prevention do?
1. Constrain how resource request are made