Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Dining philosophers ( 2 0 marks ) The dining philosopher s problem is a classic problem in Computer Science that is used to explore issues
Dining philosophers marks
The dining philosophers problem is a classic problem in Computer Science that is used to explore issues in
deadlock, arbitration, and mutual exclusion. In the problem, we have a set of n philosophers, n chopsticks, and n
bowls of noodles. The philsophers are sitting at a round table with one chopstick between each pair of philosophers.
To eat, a philosopher must have two chopsticks.
When a philosopher is hungry, they request the chopstick to
their right and the chopstick to their left.
The challenge is to define an arbitration mechanism of allo
cating chopsticks to philosophers such that if a philosopher is
hungry, the philosopher eventually gets both the chopstick to
their left and the chopstick to their right and so gets to eat.
In this question, you will prove a small part of the Dining
Philosophers problem.
Your proof will probably require approximately steps.
You will probably not use some of the assumptions.
Part way through the proof, you will probably do an Orelim
on asm and then have two subproofs with very similar rea
soning.
Be careful to avoid variable capture!
The proof rules used in the solution are:
Forallelim
Existselim
Implelim
Orelim
Subst
Asms to finish the proof
ECE: Winter Asn: Dining Philosophers
Given the environment:
Type phil philosophers
Type stick chopstick
reqp : phil, s : stick : B p requests the chopstick s
getp : phil, s : stick : B p gets the chopstick s
lfstkp : phil : stick the chopstick to the left of p
rtstkp : phil : stick the chopstick to the right of p
eatp : phil : B : getp lfstkp getp rtstkp
Prove:
s : stick p : phil s rtstkp
s : stick p : phil s lfstkp
p : phil reqp lfstkp reqp rtstkp
p : phil getp lfstkp getp rtstkp
p : phil s : stick reqp s s lfstkp s rtstkp
p : phil s : stick getp s reqp s new
s : stick p : phil reqp s p : phil getp s
p : phil s : stick getp s p : phil p p getp s
p : phil s : stick reqp s p : phil eatp
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