Module 8: Deadlocks Flashcards

1
Q

Deadlocks

A

suppose there is a finite set of resource and there are multiple threads or processes requesting these resources. there is a deadlock if the threads are waiting on resources held by other threads in a cycle such that none of the threads in this cycle will be able to proceed.

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

conditions for deadlock (4)

A
  1. mutual exclusion
  2. resource preemption
  3. hold and wait
  4. circular waiting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

mutual exclusion

A

resources held by one process cannot be simultaneously used by another process

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

resource preemption

A

when a process or thread acquires a particular resource, it holds onto the resource until it releases it; other processes cannot steal the resource

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

hold and wait

A

a process can accumulate resources and does not have to grab all the resources that it needs at the same time

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

circular waiting

A

circular chain of processes that are requesting resources from each other

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

hierarchical allocation (deadlock prevention)

A

create a policy that determines which processes can receive which resources by creating a hierarchy between the resources or between the processes

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

resource allocation graph (deadlock detection)

A

a RAG is a tool for deadlock detection because deadlock only occurs if the RAG has a cycle (IFF). to form a RAG, there is a node for every process and a node for every resource. if a process P currently has resource R, then we form a directed edge from R to P. If process P is requiring process R, the we form a directed edge from P to R.

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

wait-for graph (deadlock detection)

A

shows dependencies of processes or threads that are waiting on others.
to form this graph, there is a node for each process/thread, and there is a directed edge Pi to Pj if Pi is waiting on a resource from Pj.

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

checkpointing

A

save the state (of a process) in case of a required rollback of operations to the process

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

safe-allocations (deadlock avoidance)

A

an allocation state is safe if there is a sequential ordering of processes such that all the processes will be able to finish executing

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

banker’s algorithm (deadlock avoidance)

A

given n processes and m resources, the algorithm only grants resources to a process if it will result in a safe allocation state

Re[i,j]: matrix representing the number of resources Rj requested by Process Pi

C[i,j]: matrix representing the amount of resource Rj currently held by process Pi

M[i,j]: matrix representing the maximum amount of resource Rj that a process Pi will ever request

A[j]: vector representing the number of resources Rj that are currently free

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