ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > Class(2017-2018-1)ZSTU > student homework directory > >
Homework 6 Version 0
👤 Author: by 657500811qqcom 2017-11-16 06:29:52


Consider v the dining -philosophers problem where the chopsticks are placed at the center of the table and any two of them could be used by a philosopher. Assume that requests for chopsticks are made one at a time. Describe a simple rule for determining whether a particular request could be satisfied without causing deadlock given the current allocation of chopsticks to philosophers.



Answer:

For a deadlock to occur,each of the four necessary conditions must hold:

1.Mutual Exclusion 2.Hold and Wait 3.No Preemption 4.Circular Wait.

If we ensure that at least one of these conditions cannot hold,we can prevent the occurrence of a deadlock.

For this problem,we can pay attention to some conditions.When a philosopher asks for a chopstick,we should

check whether the number of remaining chopsticks is more than two.Besides,we should also check how many

philosophers are in the state that holding one chopsticks.If the number of these philosophers are more than

the number of remaining chopsticks ,we should not satisfy the requset of the latest philosopher.

Please login to reply. Login

Reversion History

Loading...
No reversions found.