1What is deadlock in a multiprogramming environment?
A deadlock occurs when one or more processes are waiting indefinitely for a resource or event held by another waiting process.
2What are the three steps a process uses a resource under normal operation?
Request - Use - Release
3What is a resource?
Anything that can only be used by a single process at any instant of time.
4What are preemptable resources?
Resources that can be taken away from the process owning them with little or no effect (e.g., memory).
5What are non-preemptable resources?
Resources that cannot be taken away from their current owner without causing computation to fail (e.g., printer).
6Why do deadlocks generally involve non-preemptable resources?
Because these resources cannot be forcibly taken from processes, making it possible for a cycle of waiting to occur.
7Give an example of a deadlock situation.
Process A holds a printer and wants a disk drive, while Process B holds a disk drive and wants the printer; both are blocked indefinitely.
8What are the four necessary conditions for deadlock?
Mutual Exclusion, Hold and Wait, No Pre-emption, Circular Wait
9What is mutual exclusion in deadlock?
At least one resource is in a non-shareable mode, meaning only one process can use it at a time.
10What is hold and wait?
A process is holding at least one resource while waiting to acquire additional resources held by other processes.
11What is no pre-emption?
Resources cannot be forcibly taken from a process; they are released only after the process finishes using them.
12What is circular wait?
A set of processes exists where each process is waiting for a resource held by another process in the set, forming a cycle.
13What are the three methods for handling deadlocks?
Deadlock Prevention, Deadlock Detection and Recovery, Ignore the Problem
14What is deadlock prevention?
A set of methods to ensure that at least one of the necessary conditions for deadlock does not hold in the system.
15How can mutual exclusion be prevented in deadlock prevention?
Allow resources to be shared if possible so that deadlocks cannot occur.
16How can hold and wait be prevented?
A process must request all required resources at once and cannot hold other resources while waiting.
17How can no pre-emption be prevented?
If a requested resource is unavailable, all resources held by the process must be preempted.
18How can circular wait be prevented?
Impose a total ordering on all resource types; processes must request resources in increasing order.
19What is deadlock avoidance?
Using additional information about future resource requests to decide whether processes should wait or proceed to prevent deadlock.
20What is the Banker's Algorithm used for?
Deadlock avoidance in systems with multiple processes competing for resources.
21What are the two main components of the Banker's Algorithm?
Safety Algorithm and Resource Request Algorithm
22What does the Safety Algorithm do in Banker's Algorithm?
Checks if the system is in a safe state with a sequence of processes that can execute to completion.
23What does the Resource Request Algorithm do in Banker's Algorithm?
Checks if granting a resource request keeps the system in a safe state.
24What is the first step in Banker's Algorithm calculation?
Calculate NEED for each process as MAX - ALLOCATION.
25What is the second step in Banker's Algorithm calculation?
Calculate AVAILABLE resources as Total Resources - Sum of ALLOCATION.
26What is the third step in Banker's Algorithm calculation?
Find a safe sequence by iterating through processes and checking if Need <= Available.
27What is deadlock detection?
Algorithmically examining the system to determine if a deadlock has occurred when prevention or avoidance is not used.
28What are common deadlock recovery methods?
Informing the operator, automatic system recovery, breaking the deadlock via process termination or resource pre-emption.
29Why is deadlock recovery important?
To ensure the system does not cripple throughput and CPU utilisation does not drop.