Chapter 7 Pt.1.1 Flashcards

(30 cards)

1
Q

List the three phases of resource use in the system model

A

Request → Use → Release.

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

What are resource types and instances?

A

A resource type is a category of resource (e.g., printer, mutex, CPU). An instance is one specific unit of that type (e.g., Printer #1).

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

Mutual Exclusion

A

At least one resource must be nonsharable—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

Hold + Wait

A

A process holds one or more resources while waiting to acquire additional resources.

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

No Preemption

A

Resources can’t be forcibly taken 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

Circular Wait

A

A cycle of processes exists where each waits for a resource held by the next process in the cycle.

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

Can we deny mutual exclusion to prevent deadlock?

A

Only for resources that can be made sharable; many resources (e.g., mutexes, printers) are inherently nonsharable.

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

Prevention for hold and wait and it’s downside: describe Method 1

A

Require a process to request all resources it needs at once before it begins execution. Downside: Low resource utilization and potential starvation because resources may be held even when not immediately used.

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

Prevention for hold and wait and it’s downside: describe Method 2

A

Require a process to release all held resources before requesting any new ones. Downside: More overhead and delays; can reduce throughput and still risk starvation.

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

Prevention for no preemption + Downside

A

If a process holding resources requests another unavailable resource, preempt its held resources and make the process retry later. Downside: Not practical for many resources and can cause overhead or starvation.

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

Prevention for circular wait: what is the key idea?

A

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

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

What simple rule prevents circular wait when using two locks?

A

Always acquire the two locks in the same fixed order (e.g., Lock A then Lock B).

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

Request Edge

A

Pi → Rj means process Pi is requesting an instance of resource type Rj.

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

Assignment Edge

A

Rj → Pi means an instance of resource type Rj is allocated to process Pi.

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

Single Instance + No Cycle

A

= No Deadlock, if there is no cycle, deadlock cannot occur.

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

Single Instance + Cycle

A

= Deadlock, when each resource type has one instance, a cycle implies deadlock.

17
Q

Multiple Instances + Cycle

A

= Possible Deadlock, True—cycle indicates possible deadlock, not guaranteed.

18
Q

Safe State

A

A state where a safe sequence exists—processes can finish one by one using available resources plus resources released by earlier processes.

19
Q

Unsafe State

A

A state where no safe sequence exists—deadlock is possible in the future but not guaranteed yet.

20
Q

Deadlock Avoidance

A

Dynamically decide whether to grant requests based on maximum needs so the system never enters an unsafe state.

21
Q

Deadlock Prevention

A

Design rules that ensure at least one of the four necessary deadlock conditions can never hold.

22
Q

Deadlock Detection and Recovery

A

Allow deadlock to occur, detect it (e.g., via graph/algorithm), then recover by preempting, aborting, or rolling back processes.

23
Q

Ignoring Deadlock

A

The OS does not try to prevent or detect deadlock and relies on the fact that deadlocks are rare or manageable.

24
Q

Which strategy is used by most mainstream OSes?

A

Ignoring deadlock for many general-purpose resources (the “ostrich approach”).

25
Why might ignoring deadlock be acceptable in practice?
Deadlocks may be rare, and prevention/detection can add significant overhead and complexity.
26
Explain the lock ordering idea for transactions
Assign a global order to locks; transactions must acquire locks according to that order to prevent circular wait.
27
Why can prevention lead to low utilization?
Rules like requesting all resources up front or strict ordering can cause resources to sit idle and reduce concurrency.
28
Wait For Graph
A graph of only processes; Pi → Pj means Pi is waiting for a resource held by Pj. A cycle indicates deadlock.
29
What types of resources are generally sharable vs nonsharable?
Sharable: resources that can be safely used concurrently (e.g., read-only data). Nonsharable: resources requiring exclusive use (e.g., printers, mutex locks, a file in write mode).
30
What are the cons of ignoring deadlock?
A deadlock can freeze part of the system, cause lost work, and may require manual intervention or reboot.