Unit summary

  • Cooperating processes communicate by shared memory or message passing, such as pipes and FIFOs.
  • A race condition makes results depend on timing, and critical sections need mutual exclusion, progress and bounded waiting.
  • Semaphores, with wait and signal, solve mutual exclusion and the producer-consumer problem.
  • Monitors provide automatic mutual exclusion with condition variables, and the dining-philosophers problem tests deadlock-free design.
  • Deadlock needs mutual exclusion, hold and wait, no preemption and circular wait, shown by resource-allocation graphs.
  • Deadlocks are handled by prevention, avoidance with the Banker's algorithm, detection and recovery, or ignoring them.

Glossary

Term Meaning
Banker's algorithm A deadlock-avoidance algorithm.
Bounded waiting A limit on waiting before entry.
Circular wait A cycle of processes each waiting on the next.
Condition variable A queue used with wait and signal in a monitor.
Critical section Code that accesses shared data.
Deadlock Processes waiting on each other for ever.
IPC Inter-process communication.
Monitor A construct with automatic mutual exclusion.
Mutex A lock for mutual exclusion.
Mutual exclusion Only one process in its critical section.
Pipe A one-way byte channel between processes.
Progress The choice of the next entrant is not postponed for ever.
Race condition Results depending on execution order.
Resource-allocation graph A graph of requests and assignments.
Rollback Returning a process to an earlier safe state.
Safe state A state with a safe sequence.
Semaphore A variable with atomic wait and signal.
Wait-for graph A graph of processes waiting on processes.

Question bank

Short Answer Questions (2 marks each)

  1. What is inter-process communication?
  2. Define a race condition.
  3. What is a critical section?
  4. State the requirements of a critical-section solution.
  5. Define a semaphore.
  6. What is a monitor?
  7. Define deadlock.
  8. State the four necessary conditions for deadlock.
  9. What is a safe state?
  10. What is a wait-for graph?

Medium Answer Questions (5 marks each)

  1. Explain shared memory and message passing.
  2. Explain Peterson's solution to the critical-section problem.
  3. Solve the producer-consumer problem using semaphores.
  4. Explain the dining-philosophers problem and its solutions.
  5. Explain the methods of deadlock prevention.
  6. Explain recovery from deadlock.

Long Answer Questions (15 marks each)

  1. Explain inter-process communication, race conditions and the critical-section problem with its solutions.
  2. Explain semaphores and monitors, with the producer-consumer and dining-philosophers problems.
  3. Explain deadlock, its necessary conditions, resource-allocation graphs and prevention.
  4. Explain deadlock avoidance with the Banker's algorithm, and deadlock detection and recovery.

Sources

  • Official BCA syllabus Operating Systems, course code 25BCA402DS03, Unit III