Philosophers problem

1.Comment on the following solution to the dining philosophers problem. A hungry

philosopher first picks up his left fork; if his right fork is also available, he picks up his

right fork and starts eating; otherwise he puts down his left fork again and repeats the

cycle.

2. Suppose that there are two types of philosophers. One type always picks up his left

fork first (a “lefty”), and the other type always picks up his right fork first (a“righty”).The behavior of a lefty is defined in Figure 6.12.The behavior of a righty is

as follows:

begin

repeat

think;

wait ( fork[ (i+1) mod 5] );

wait ( fork[i] );

eat;

signal ( fork[i] );

signal ( fork[ (i+1) mod 5] );

forever

end;

Prove the following:

a. Any seating arrangement of lefties and righties with at least one of each avoids

deadlock.

b. Any seating arrangement of lefties and righties with at least one of each prevents

starvation.

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X