ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > zstu-(2021-2022)-1 > student homework directories > 2019329621250_迟海滢 >
2019329621250-迟海滢-Homework-7 Version 0
👤 Author: by 2990994011qqcom 2021-10-29 07:17:24 last modified by 2990994011qqcom
There are five philosophers. The philosophers share a round table and sit on the five chairs around. There are five bowls and five chopsticks on the round table. 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 two chopsticks. After eating, the philosopher put down the left and right chopsticks and continued thinking.
If five philosophers are hungry at the same time and all pick up the chopsticks on the left, the five semaphores chopstick will all be 0. When they try to get the 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 eventually the two chopsticks he used will be released, so that more philosophers can eat.

Please login to reply. Login

Reversion History

Loading...
No reversions found.