Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dining philosophers problem
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Chandy/Misra solution === In 1984, [[K. Mani Chandy]] and [[Jayadev Misra|J. Misra]]<ref>Chandy, K.M.; Misra, J. (1984). [//www.cs.utexas.edu/users/misra/scannedPdf.dir/DrinkingPhil.pdf The Drinking Philosophers Problem]. ACM Transactions on Programming Languages and Systems.</ref> proposed a different solution to the dining philosophers problem to allow for arbitrary agents (numbered ''P''<sub>1</sub>, ..., ''P''<sub>''n''</sub>) to contend for an arbitrary number of resources, unlike Dijkstra's solution. It is also completely distributed and requires no central authority after initialization. However, it violates the requirement that "the philosophers do not speak to each other" (due to the request messages). #For every pair of philosophers contending for a resource, create a fork and give it to the philosopher with the lower ID (''n'' for agent ''P''<sub>''n''</sub>). Each fork can either be ''dirty'' or ''clean.'' Initially, all forks are dirty. #When a philosopher wants to use a set of resources (''i.e.'', eat), said philosopher must obtain the forks from his contending neighbors. For all such forks the philosopher does not have, he sends a request message. #When a philosopher with a fork receives a request message, he keeps the fork if it is clean, but give it up when it is dirty. If the philosopher sends the fork over, he cleans the fork before doing so. #After a philosopher is done eating, all his forks become dirty. If another philosopher had previously requested one of the forks, the philosopher that has just finished eating cleans the fork and sends it. This solution also allows for a large degree of concurrency, and will solve an arbitrarily large problem. It also solves the starvation problem. The clean/dirty labels act as a way of giving preference to the most "starved" processes, and a disadvantage to processes that have just "eaten". One could compare their solution to one where philosophers are not allowed to eat twice in a row without letting others use the forks in between. Chandy and Misra's solution is more flexible than that, but has an element tending in that direction. In their analysis, they derive a system of preference levels from the distribution of the forks and their clean/dirty states. They show that this system may describe a [[directed acyclic graph]], and if so, the operations in their protocol cannot turn that graph into a cyclic one. This guarantees that deadlock cannot occur by negating circular waiting. However, if the system is initialized to a perfectly symmetric state, like all philosophers holding their left side forks, then the graph is cyclic at the outset, and their solution cannot prevent a deadlock. Initializing the system so that philosophers with lower IDs have dirty forks ensures the graph is initially acyclic.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)