implement a super simple "Dining Philosophers" problem
$10-30 USD
Closed
Posted over 3 years ago
$10-30 USD
Paid on delivery
create 5 "diners" that have to eat a bowl of rice with maybe 100 "units" of rice. Have them have a collection of 5 chopsticks and each diner must grab one chopstick on their left and one on their right in order to eat a unit of rice. Once they've eaten a unit of rice, they should sleep for 100ms before trying again. Have them print out which diner is eating when they eat and which diner grabs a chopstick when they grab one. Have them implement the solution first without handling deadlock and observe the deadlock - have them lock the right chopstick, wait 10ms then lock the left. Then have them Use the [login to view URL] method to wait for 100ms to get a lock on both of the chopsticks, if it doesn't get a lock on both chopsticks, it should sleep for 100ms and then try to get a lock on both again.
Hi.
This is easy to implement, let me help you, I have 6 years of C# development experience. I have
done similar programs, if we cooperate, it will make us feel happy.