Classical IPC Problems In Operating Systems

Classical IPC Problems
1. Dining Philosophers Problem
2. The Readers and Writers Problem
3. The Sleeping Barber Problem

1. Dining philosophers problems:
There are N philosphers sitting around a circular table eating spaghetti and discussing philosphy. The problem is that each philosopher needs 2 forks to eat, and there are only N forks, one between each 2 philosophers. Design an algorithm that the philosophers can follow that insures that none starves as long as each philosopher eventually stops eating, and such that the maximum number of philosophers can eat at once.

• Philosophers eat/think
• Eating needs 2 forks
• Pick one fork at a time
• How to prevent deadlock

The problem was designed to illustrate the problem of avoiding deadlock, a system state in which no progress is possible.
One idea is to instruct each philosopher to behave as follows:

  • think until the left fork is available; when it is, pick it up
  • think until the right fork is available; when it is, pick it up
  • eat
  • put the left fork down
  • put the right fork down
  • repeat from the startThis solution is incorrect: it allows the system to reach deadlock. Suppose that all five philosophers take their left forks simultaneously. None will be able to take their right forks, and there will be a

Suraj Chand

Suraj Chand is an Author in Surajchand99.com.np and is pursuing Bachelor's Degree In Computer Engineering From Kathmandu Engineering College (KEC) IOE TU Nepal.

Leave a Reply

Back to top button

Adblock Detected

Sorry ! Please Disable your adblock .