RFR: CODETOOLS-7903021: jcstress: Dining Philosophers problem sample [v4]

Michael Mirwaldt duke at openjdk.java.net
Sat Oct 16 13:37:00 UTC 2021


On Mon, 11 Oct 2021 17:01:30 GMT, Michael Mirwaldt <duke at openjdk.java.net> wrote:

>> jcstress-samples/src/main/java/org/openjdk/jcstress/samples/concurrency/classic/ClassicProblem_01_DiningPhilosophers.java line 85:
>> 
>>> 83:                 forks[fork1].acquire();
>>> 84:                 forks[fork2].acquire();
>>> 85:                 // eating
>> 
>> Shouldn't this call `tryPickForks`?
>
> No, because the resource hierarchy solution doesn't try to pick a fork. It either picks the fork or it just waits for the fork.
> And it can wait for the lock because it can rely on the order of the forks which avoids a deadlock.
> Do you agree?

Any update?

I know you are very busy and you do a lot of tech stuff, @shipilev.
I hope you don't mind if I remind you from time to time when I need feedback.

-------------

PR: https://git.openjdk.java.net/jcstress/pull/93


More information about the jcstress-dev mailing list