What are shared resources?
Resources shared by processes, classified as:
- Physical (e.g., processor, memory, I/O
- Logical (e.g., data structures, message queues).
What are reusable and consumable resources?
What are the three main synchronisation problems?
What is a deadlock?
A situation where two or more processes wait indefinitely for resources held by each other, creating a cycle of dependencies.
What are the four conditions for a deadlock to occur?
What is deadlock modelling using directed graphs?
Scheduling choices can avoid or cause deadlock. A resource graph can be created & checked at each step. When is a deadlock guaranteed to happen?
When it contains a cycle, then there is a deadlock
What are the four strategies to deal with a deadlock?
Why must the OS keep track of the current state to avoid deadlocks?
To determine whether it is safe or unsafe
What is a safe state vs. an unsafe state?
What is the banker’s algorithm?
A deadlock avoidance algorithm that evaluates resource allocation states to ensure safe system operation.
How does the banker’s algorithm work?
We have three 2D tables:
- Allocation table
- Max table
- Available table.
The Allocation table holds the amount of each resource each process is currently using.
The Max table holds the amount of each resource each process requires to finish.
The Available table holds the amount of each resource that is currently available for allocation.
For row=1 (the first row) we create a table Need that each row includes Max[row] - Allocation[row]
Then, for each row in the Need table, we check if Need[row] <= Available[row]. If no row satisfies this then the system is in an unsafe state. If a row satisfies this, then, Available += Allocation[row], and For each resource in Need[row] the amount becomes 0.
This is repeated until all the rows of Need have their resources of 0 amounts.