I’ll keep each answer short enough for 2 marks, but with enough key information to score full marks. I’ve also added a 🧠 Easy Memory line for quick revision.
Process synchronization is the coordination of multiple processes so that they can safely access shared data and resources.
Importance:
- Prevents data inconsistency and race conditions.
- Ensures proper and orderly execution of processes.
> Synchronization = Coordinate processes + Protect shared data
The Critical Section Problem is the problem of ensuring that when multiple processes access shared data, only one process enters its critical section at a time.
One requirement:
Mutual Exclusion – Only one process can execute inside the critical section at a time.
> Critical Section = Shared data → One process at a time
A correct solution must satisfy:
-
Mutual Exclusion
Only one process can be inside the critical section at a time. -
Progress
If the critical section is free, a process that wants to enter should not be unnecessarily delayed.
Another requirement: Bounded Waiting – A process should not wait forever.
Mutual Exclusion = One
Progress = Go when free
| Busy Waiting | Blocking |
|---|---|
| Process continuously checks for a resource while waiting. | Process is put into a waiting/sleep state until the resource becomes available. |
| CPU time is wasted while waiting. | CPU can be given to another process. |
Example:
Busy Waiting:
Blocking:
> Busy Waiting = Keep checking
Blocking = Sleep and wait
A semaphore is a synchronization variable used to control access to shared resources and coordinate processes.
Its two basic operations are:
- wait() – Requests/acquires a resource; the process may have to wait if the resource is unavailable.
- signal() – Releases a resource and can wake a waiting process.
> wait() = Acquire / Wait
signal() = Release / Notify
A deadlock is a situation where two or more processes are permanently waiting for resources held by each other, so none can continue.
Effect on system performance:
Deadlock causes processes to stop progressing, wastes system resources, and reduces CPU utilization and throughput.
> Deadlock = Everyone waits → Nobody moves → Performance falls
The four necessary conditions are:
- Mutual Exclusion – Resource can be used by only one process at a time.
- Hold and Wait – Process holds one resource while waiting for another.
- No Preemption – Resources cannot be forcibly taken from a process.
- Circular Wait – Processes wait for resources held by one another in a circular chain.
> M → H → N → C
Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait
Memory sentence:
> “My Hands Never Cross.”
| Deadlock Prevention | Deadlock Avoidance |
|---|---|
| Prevents deadlock by eliminating at least one necessary condition. | Avoids deadlock by checking whether resource allocation keeps the system safe. |
| Uses fixed rules or restrictions. | Makes allocation decisions dynamically. |
| Example: Resource ordering. | Example: Banker's Algorithm. |
> Prevention = Break the condition
Avoidance = Check before giving resources
A Resource Allocation Graph (RAG) is a graph used to represent the relationship between processes and resources.
It shows:
- Which resources are allocated to processes.
- Which resources are requested by processes.
Purpose:
It is used to analyze and identify possible deadlocks, especially by checking for cycles in the graph.
> RAG = Who has what + Who wants what
Basic symbols:
□ = Resource
Process → Resource = Resource is requested Resource → Process = Resource is allocated
0 Comments