Skip to content

Lab-1: implement dining programmers problem solution #16

Open
Kkkkkk58 wants to merge 5 commits intomasterfrom
review1
Open

Lab-1: implement dining programmers problem solution #16
Kkkkkk58 wants to merge 5 commits intomasterfrom
review1

Conversation

@Kkkkkk58
Copy link

@Kkkkkk58 Kkkkkk58 commented Oct 8, 2025

Хасан Карим Асадович, M4175

var plate = new Plate(id, consumedSoupPortions);
foodProvider.refillPlate(plate);
while (plate.isEmpty() && foodProvider.isServing()) {
plate.askToRefill();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет вайба, что можно попросить еду в тарелку перед тем как думать? Тогда будто не придется крутиться в цикле и постоянно что то спрашивать

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

так суп остынет же!

Copy link
Author

@Kkkkkk58 Kkkkkk58 Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а если серьёзно - да, там действительно можно уйти от цикла.
изначально думал про подверженность spurious wakeups, но забыл проверить, есть ли такая проблема с CountDownLatch. судя по документации - нет, внезапных пробуждений быть не должно.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants