OS_Assignment_2_Answers
OS_Assignment_2_Answers
- Race condition: Occurs when multiple processes access and manipulate shared data
- Critical section: A section of code where shared resources are accessed and only one
- Mutual exclusion: Ensures that only one process can enter the critical section at any given
time.
binary or counting.
- Bounded waiting: A limit on the number of times a process can be bypassed by others while
share information.
- Initialization:
- Producer Process:
- wait(empty);
- wait(mutex);
- signal(mutex);
- signal(full);
- Consumer Process:
- wait(full);
- wait(mutex);
- signal(mutex);
- signal(empty);
- Deals with synchronization when multiple readers and writers access shared data.
- Constraints:
4. Dining-philosophers Problem
- Five philosophers sit around a table with one fork between each pair.
- Deadlock: A situation where a set of processes are blocked, each waiting for resources held
by the others.
- - Mutual Exclusion
- - No Preemption
- - Circular Wait
- Example: