CS241 - OS (Handling Deadlocks)

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Nope!

Can there be deadlocks if a system is in a safe state?

A total ordering is imposed upon all resource types, and each process is required to request resources in increasing order of enumeration

How does Deadlock Prevention work with regards to: Circular wait

Guarantee that whenever a process requests a resource, it does not hold any other resources, OR it must request and be allocated all its' resources before it begins execution

How does Deadlock Prevention work with regards to: Hold and Wait

Well, lol, it can't be prevented for non-sharable resources. So really, pick another condition to restrain

How does Deadlock Prevention work with regards to: Mutual Exclusion

If a process A, holding some resources, requests another resource that cannot be immediately allocated to it, then all A's allocated resources are released. A will restart only when it can both regain its old resources, and be allocated the new ones it is requesting.

How does Deadlock Prevention work with regards to: No Preemption

The resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes

How is the resource-allocation state defined, in a deadlock avoidance system?

Depending on which kind of edge keeps the RAG cycle-free (Remember, it is a digraph, and request and assignment edges point in different directions)

In a RAG, what determines whether a claim edge becomes an assignment edge or a request edge?

Claim edge Pi --> Rj is converted to request edge Pi -> Rj if the resource is *not granted immediately*

In a RAG, when is a claim edge converted to a request edge?

Claim edge Pi --> Rj is converted to assignment edge Rj -> Pi if the resource is *granted immediately*

In a RAG, when is a claim edge converted to an assignment edge

Nope! There *may* be deadlocks

Is it guaranteed that there will be deadlocks if a system is in an unsafe state?

Yes! P0 needs another 5. P1 needs another 2. P2 needs another 7. If all processes claim their max resources, we can execute the processes in the following order: P1 -> P0 -> P2

Is this system in a safe state?

Ensure that at least of the four necessary conditions for deadlocks does not hold: CHoMN -Circular Wait -Hold and Wait -Mutual Exclusion -No Preemption

Outline how Deadlock Prevention works

Each process declares the max number of resources of each type that it may need *in advance*. The avoidance algorithm dynamically examines the resource-allocation state, to ensure it is *safe*.

Outline how a *Deadlock Avoidance* system works

In addition to request and assignment edges, we introduce a *claim edge*, where Pi --> Rj indicates Pi may request resource Rj in the future. When Pi requests Rj, the claim edge Pi --> Rj is converted to either a *request edge* (if the resource is not granted immediately) or an assignment edge Rj -> Pi (if the resource is immediately granted). The above decision depends on which allocation keeps the Resource Allocation Graph cycle free

Outline how a Resource Allocation Graph-based deadlock avoidance algorithm works

-Any process can claim maximum use at any time -When a process requests a resource, it may have to wait -When a process gets all its resources, it must return them in a *finite* amount of time

Outline the underlying assumptions involved in Deadlock Avoidance algorithms

When there are/is a: -Multiple instances per resource type -Single instance per resource type

What are the broad situations that a deadlock avoidance algorithm will need to account for?

Deadlock *prevention* and deadlock *avoidance*

What are the two main ways to ensure that a system *never* enters the deadlock state?

It needs a priori information: -Each process must declare the maximum number of resources of each type that it may need

What does a *Deadlock Avoidance* system require of its' processes?

The "head-in-the-sand" approach. Pretend deadlocks never occur - it's the programmer's responsibility to write deadlock-free code.

What is UNIX's approach to handling deadlocks?

4. In the worst case, P0 can be assigned 1, and P1 can be assigned 2. If both processes then request one more resource, just one more will be sufficient to keep the system in a safe state.

What is the minimum number of resources required to guarantee that deadlock never occurs?

The kind that use a variant of the Resource Allocation Graph

What types of deadlock avoidance algorithms are appropriate for situations with a single instance per resource type?

Variants on the *banker's algorithm*

What types of deadlock avoidance algorithms are appropriate for situations with multiple instances per resource type?

A state is safe if the system can allocate resources to each process, up to its maximum, in some order and avoid deadlock.

When is a resource-allocation state deemed safe by a deadlock-avoidance algorithm?

A system is in a safe state if there exists a sequence P1, P2, ..., Pn of *all* the processes in the system, such that: For each Pi, the resources Pi can request can be satisfied by either the *currently available resources*, or *resources held by all the Pj*, with j < i

When is a system in a *safe state*?

When there is only one resource instance per resource type

When should you use a RAG-based Deadlock Avoidance algorithm?

Deadlock prevention works by preventing at least one of the necessary conditions of deadlock from happening. This means it *may* prevent a process from requesting further resources if it is already holding some. Therefore A is false, and C is true.

Which of the following is NOT true?

Because then Pi can wait until all processes Pj have finished executing. When Pi terminates, P(i+1) can get its resources, and so on. It avoids circular dependency!

Why is a system in a safe state if for a process in the sequence Pi, all the resources it can request are held by the Pj processes, where j < i?

Because deadlock prevention works by preventing at least one of the necessary conditions of deadlock from happening, and that could mean imposing a harsh restriction like only being able to request resources if not already holding some. Deadlock avoidance just fiddles with the assignment of resources themselves, to avoid deadlocks during the running of the system.

Why is deadlock avoidance less restrictive than deadlock prevention?


Kaugnay na mga set ng pag-aaral

ATI - Priority Setting Frameworks Beginning & Advanced Test

View Set

"The Stone" Vocabulary words, The Stone Review

View Set

Communication Final Exam Evan Griffin

View Set

Contingencies and Commitments/Derivatives and Hedge Accounting /Foreign Currency Transactions and Translation

View Set

Qualitative Research: Data Collection Methods

View Set

ADMN 417 Learning Objectives Lesson 1-9

View Set