# Dining Philosophers (Diners) Problem n definition n Chandy and Misra solution n extension to drinking philosophers.

## Presentation on theme: "Dining Philosophers (Diners) Problem n definition n Chandy and Misra solution n extension to drinking philosophers."— Presentation transcript:

Dining Philosophers (Diners) Problem n definition n Chandy and Misra solution n extension to drinking philosophers

Definition n extension to mutual exclusion n arbitrary topology n each philosopher (process) proceeds through the following cycle u thinking (out of the CS) may remain indefinitely u hungry (requesting the CS) u eating (executing the CS) has to finish within finite time n solution properties u safety – no two neighbors eat at the same time u liveness – each hungry philosopher eventually eats n can a DMX solution be used to solve the diners problem? If yes, would this solution be efficient?

Chandy-Misra[84] (Hygenic) Solution Setup n each pair of diners share a fork u fork is clean before eating, fork is dirty during and after u diner cleans the fork only before giving it to neighbor n edge between diners u and v is oriented from u to v (u has higher priority) if u u holds clean fork u v holds dirty fork, u fork is in transition from v to u n initially, thus oriented graph is acyclic, all forks are dirty

Chandy-Misra[84] (Hygenic) Solution Details n if diner does not have fork – it sends request to the neighbor n process gives up dirty forks and holds clean n diner can only wait for higher priority neighbor notice after eating, diner is a source (all his forks are dirty) graph remains acyclic throughout operation acyclic graph has a sink (lowest priority diner), that diner is guaranteed to eat

Extension to Drinking Philosophers n definition u arbitrary topology u each pair of drinking philosophers share a bottle u philosopher alternates between being tranquil, thirsty and drinking u philosopher may be tranquil indefinitely but drinks only for finite amount of time u philosopher may request to drink from an arbitrary subset of adjacent bottles n properties u two neighbors cannot drink from the same bottle at the same time u each thirsty philosopher eventually drinks n relation to the other problems u can a solution to diners be used to solve the drinking philosophers problem? Can a DMX solution? If yes, are they going to be efficient?

Download ppt "Dining Philosophers (Diners) Problem n definition n Chandy and Misra solution n extension to drinking philosophers."

Similar presentations