• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..04-Oct-2021-

README.mdH A D04-Oct-20211.3 KiB2621

dining_philosophers.cppH A D04-Oct-202112.4 KiB336253

README.md

1# Dining_philosophers sample
2The Dining Philosophers problem demonstrates `oneapi::tbb::flow` and the use of the reserving `join_node` to solve the potential deadlock.
3
4This 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.
5
6## Building the example
7```
8cmake <path_to_example>
9cmake --build .
10```
11
12## Running the sample
13### Predefined make targets
14* `make run_dining_philosophers` - executes the example with predefined parameters.
15* `make light_test_dining_philosophers` -  executes the example with suggested parameters to reduce execution time.
16
17### Application parameters
18Usage:
19```
20dining_philosophers [n-of_threads=value] [n-of-philosophers=value] [verbose] [-h] [n-of_threads [n-of-philosophers]]
21```
22* `-h` - prints the help for command line options.
23* `n-of_threads` - number of threads to use; a range of the form low\[:high\[:(+|*|#)step\]\], where low and optional high are non-negative integers or 'auto' for the default choice, and optional step expression specifies how thread numbers are chosen within the range.
24* `n-of-philosophers` - how many philosophers, from 2-26.
25* `verbose` - prints diagnostic output to screen.
26