Question

In: Computer Science

Operating Systems: We have learned two methods for the Dining Philosophers Problem. Can you come up...

Operating Systems:

We have learned two methods for the Dining Philosophers Problem. Can you come up with other solutions? Make sure your solution works. Wrong solution does not count. (20 points)

Solutions

Expert Solution

plz check the below content.

page 2

page 3

No need to remember the just check the wait and signal logics once .

simplified answer plz check the below.

plz assume a table , it contains five philosopher.

every one is having two states 1.Think, 2.eat

void philosopher (void)

{

while (trw)

{

thinking ();

take_fork(i); // left fork

take_ fork(i+1)%N); // right fork , N is no.of forks

EAT();

put_fork(i);

put_fork(i+1)%N);

}

}

here we are using semaphores S0, S1 ,S2, S3, S4

for this we need to used wait and signal for the code process

wait(take_fork(Si));

wait(take_fork(S(i+1)modN));

signal(put_fork(i);)

signal(put_fork((i+1)%N));

plz use dead locks to understand.


Related Solutions

Briefly explain the deadlock situation that can occur in the dining philosophers and how we could...
Briefly explain the deadlock situation that can occur in the dining philosophers and how we could resolve the problem.
can you explain in details how did we come up with this answer and how to...
can you explain in details how did we come up with this answer and how to answer similar.. what is the economic concept behind it A serious drought has created a shortage of food across the country. In an attempt to maximize profits, one grocery store decided to auction off its limited supply of food. Which of the following scenarios is the MOST likely to occur in this situation? A. The willingness to pay for food would rise. B. The...
can you explain in details how did we come up with this answer and how to...
can you explain in details how did we come up with this answer and how to answer similar what is the economic concept behind this NO.152 A pharmaceutical company was recently awarded a 20 year patent for a new medicine it has developed. Which of the following results could be a consequence of this patent? (Select all that apply.) A. The high price of the medicine will result in insufficient demand. B. The pharmaceutical company will charge higher prices for...
can you explain in details how did we come up with this answer and how to...
can you explain in details how did we come up with this answer and how to answer similar NO.148 Two years ago, the purchasing manager at a company spent $25,000 on a new machine that would improve production efficiency at the company. The manufacturers of the machine release an updated model that costs $35,000 and that promises to further improve production efficiency. Under what conditions should the purchasing manager upgrade to the new model? A. If the savings from the...
For the Yield Management Model, we have learned to solve the problem with two prices (Full...
For the Yield Management Model, we have learned to solve the problem with two prices (Full fare vs Discount fare). Briefly describe how you will apply the model to practice.
when we are solving a momentum transfer problem for a newtonian fluid we have two methods...
when we are solving a momentum transfer problem for a newtonian fluid we have two methods to solve : 1/ shell balance 2 / Navier Stokes equation Q / when we are using Navier stokes equation. do we need continouity equations in order to solve the problem ? if yes please provide step by step method to solve the momentum transfer problem?
How can we come up with the numbers for the Benefits / Disbenefit / and Cost?...
How can we come up with the numbers for the Benefits / Disbenefit / and Cost? of these topics for Covid-19 Wash Hands: $ Benefits, and $ Cost Avoid Close Contact: $ Benefits, and $ Cost Wearing Mask: $ Benefits, and $ Cost Hand sanatizers: $ Benefits, and $ Cost Monitor Your Health: $ Benefits, and $ Cost Medical Health Care: $ Benefits, and $ Cost Vaccination: $ Benefits, and $ Cost Please Help me out, I can't seem to...
Control chart systems can operate on two basic methods of measurement. State these two methods and...
Control chart systems can operate on two basic methods of measurement. State these two methods and briefly distinguish between them, giving three examples of industrial processes where each might be applied. Specify an appropriate sampling procedure in each case.
what business we can relate to and come up with a news presentation on firms in...
what business we can relate to and come up with a news presentation on firms in competitive markets
To come up with a problem definition, write up some sample questions you would ask the...
To come up with a problem definition, write up some sample questions you would ask the president of Java Airlines to better help what they would like their software to do. Be Creative in your questions! Write up a mock Problem Definition Statement to summarize what you think the Java Airline software should be. Attention to detail will earn full marks on this assignment.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT