Question
Any deadlock-free solution of Dinning-philosopher does not guarantee that there will be no starvation. You are required to provide a starvation-free code that allows a
Any deadlock-free solution of Dinning-philosopher does not guarantee that there will be no starvation. You are required to provide a starvation-free code that allows a philosopher to pick-up chopsticks for ith time only if the other four philosophers have eaten (i-1) time(s). Example:
Philosopher#1 can be allowed to pick-up chopsticks to eat 2nd time only if other philosophers have eaten at least 1 time. Assume that all of the five philosophers are coming for eating after thinking for some finite amount of time.
Pseudocode of a function the philosopher threads would be extended from: Void philosopher (int n) // n is the philosopher number { While(1) { Pickup chopsticks Eat Putdown chopsticks Think } }
Please note this is a coding solution and should be answered in C.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started