Skip to content

Expected result of 'Dining Philosophers' example is not possible by following the instructions #30471

Closed
@platy

Description

@platy

I see that the delay between picking up the forks was added later and I think the end of the instructions hasn't been updated to fit.

The text at the end says "With this, our program works! Only two philosophers can eat at any one time, and so you’ll get some output like this:" with a trace showing 2 philosophers eating at a time.

What we actually get is:

Emma Goldman is eating.
Emma Goldman is done eating.
Karl Marx is eating.
Karl Marx is done eating.
Gilles Deleuze is eating.
Gilles Deleuze is done eating.
Judith Butler is eating.
Judith Butler is done eating.
Michael Foucault is eating.
Michael Foucault is done eating.

With the 150ms delay between picking up forks, when the philosophers go to pick up their second forks, only fork 4 is available - so Emma Goldman can eat, when she finishes Karl Marx can use fork 3.

Without the 150ms delay the behaviour matches the description, with 2 eating at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions