forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: philosophers: move to rst syntax
Change-Id: Idc808f062853bc201c22e4c30f0e3687f055265d Signed-off-by: Anas Nashif <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Dining Philosophers | ||
################### | ||
|
||
Overview | ||
======== | ||
|
||
An implementation of a solution to the Dining Philosophers problem (a classic | ||
multi-thread synchronization problem). This particular implementation | ||
demonstrates the usage of multiple preemptible and cooperative threads of | ||
differing priorities, as well as dynamic mutexes and thread sleeping. | ||
|
||
The philosopher always tries to get the lowest fork first (f1 then f2). When | ||
done, he will give back the forks in the reverse order (f2 then f1). If he | ||
gets two forks, he is EATING. Otherwise, he is THINKING. Transitional states | ||
are shown as well, such as STARVING when the philosopher is hungry but the | ||
forks are not available, and HOLDING ONE FORK when a philosopher is waiting | ||
for the second fork to be available. | ||
|
||
Each Philosopher will randomly alternate between the EATING and THINKING state. | ||
|
||
Building and Running | ||
==================== | ||
|
||
This project outputs to the console. It can be built and executed | ||
on QEMU as follows: | ||
|
||
.. code-block:: console | ||
make qemu | ||
Sample Output | ||
------------- | ||
|
||
.. code-block:: console | ||
Philosopher 0 [P: 3] HOLDING ONE FORK | ||
Philosopher 1 [P: 2] HOLDING ONE FORK | ||
Philosopher 2 [P: 1] EATING [ 1900 ms ] | ||
Philosopher 3 [P: 0] THINKING [ 2500 ms ] | ||
Philosopher 4 [C:-1] THINKING [ 2200 ms ] | ||
Philosopher 5 [C:-2] THINKING [ 1700 ms ] | ||
This file was deleted.
Oops, something went wrong.