The Dining Philosophers problem demonstrates tbb::flow and the use of the reserving join node to solve the potential deadlock.

This program runs some number of philosophers in parallel, each thinking and then waiting for chopsticks to be available before eating. Eating and thinking are implemented with sleep(). The chopstick positions are represented by a queue_node with one item.

System Requirements

For the most up to date system requirements, see the release notes.

Files
dining_philosophers.cpp
Source code for the example.
Makefile
Makefile for building the example.
Directories
msvs
Contains Microsoft* Visual Studio* workspace for building and running the example (Windows* systems only).
xcode
Contains Xcode* IDE workspace for building and running the example (macOS* systems only).

For information about the minimum supported version of IDE, see release notes.

Build instructions

General build directions can be found here.


Up to parent directory
Legal Information

Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
* Other names and brands may be claimed as the property of others.
© 2019, Intel Corporation