ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > zstu-(2021-2022)-1 > student homework directories > 2019329621127毛雷溥浩 >
201929621127 毛雷溥浩 homework7 Version 0
👤 Author: by 2972850556qqcom 2021-12-15 02:39:31
There are five philosophers.The philosophers share a round table and sit on the five chairs around. There are five bowls and fve chopsticks on the oundtable. Usually philosophy When he was hungry, he tried to take the chopsticks closest to him on the left and right. He could only eat when he got twochopsticks. After eating, the philosopher put down the left and right chopsticks and continued thinking.
lf five philosophers are hungry at the same time and all pick up the chopsticks on the left the five semaphores chopstick will al be 0.When theyty ogetthe chopsticks on the right, they will all wait indefinitely without chopsticks. Then will be deadlock.
solution:
a、Mutual Exclusion、Hold and Wait、No Preemption、Circular Wait
b、At most only four philosophers are allowed to eat at the same time to ensure that at least one philosopher can eat,and eventuly the two chopsticks heused will be released, so that more philosophers can eat.

Please login to reply. Login

Reversion History

Loading...
No reversions found.