sponsored links
The dining philosophers problem is considered as a classic synchronization problem, neither because of its practical importance, nor because the scientists dislike philosophers (as mentioned above), but because it is an example for a large class of concurrency control problems. It is a simple representation of the need to allocate several resources among several processes in deadlock and starvation free manner.
In short, we can state the "Dining philosopher's problem: as follows :
Devise an algorithm that will allow the philosophers to eat. The algorithm must satisfy mutual exclusion (no two philosophers can use the same form at the same time) while avoiding deadlock and starvation.
The following is a solution that uses semaphores. Each philosopher picks up first fork on the left and then the fort on the right. After the philosopher finishes eating, the two forks are replaced on the table. This solution, also, leads to deadlock. If all the philosophers are hungry at the same time they all sit down, they all pick up the form on their left, and they all reach out fork the other fork, which isn't there. In this undignified position, all philosophers starve.
To overcome the risk of deadlock, we could buy five additional forks or teach the philosophers to each the food with just one fork. As another approach, we could consider adding a footman who allows only four philosophers at a time into the dining room. With at most four seated philosophers at each one philosopher will have access to two forks. This solution is free of dead lock and starvation.
Sai Spandana Kotturi
sponsored links
Please Explain in deep.. with solution .. Thank You .!
ReplyDeletesir tell me various government job for me I am final year engineering student with INFORMATION TECHNOLOGY BRANCH
ReplyDelete