Skip to content

Лабораторная работа #1#8

Open
wshamin wants to merge 6 commits intoreview1from
review1
Open

Лабораторная работа #1#8
wshamin wants to merge 6 commits intoreview1from
review1

Conversation

@wshamin
Copy link

@wshamin wshamin commented Sep 24, 2025

Усложненная задача об обедающих философах

Choose a reason for hiding this comment

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

Расскажите, пожалуйста, почему вы выбрали именно такую структуру? Как у вас дела с условием, что все накормлены примерно одинаково?

Copy link
Author

@wshamin wshamin Oct 2, 2025

Choose a reason for hiding this comment

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

Изначально идея была в том, что официант может принести только одно блюдо одному разработчику, поэтому я использовал SynchronousQueue для асинхронной передачи еды из общего пула разработчикам.

Но столкнулся с проблемой, что программисты получали еду по двум очередям, из-за чего возникала ошибка с выполнением условия, увидел ее при рандомизации времени поедания и обсуждения.

Перевёл обоих официантов на одну общую очередь кухни.

7e9d1b5

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.

Choose a reason for hiding this comment

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

Предлагаю избавиться от всех while true в коде, вроде тут без них вполне можно обойтись

Copy link
Author

Choose a reason for hiding this comment

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

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.

7e9d1b5

Замеры сделал:

FIXED = 39727 ms
WORK_STEALING = 40627 ms
CACHED = 42535
SINGLE = не исполнился

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.

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

Comments