Skip to content

Commit adfa334

Browse files
kartbencarlescufi
authored andcommitted
doc: samples: philosophers: fix formatting and spelling
Improved the formatting of the overview and fixed minor grammar issues Signed-off-by: Benjamin Cabé <[email protected]>
1 parent 02df234 commit adfa334

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

samples/philosophers/README.rst

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,28 @@ preemptible and cooperative threads of differing priorities, as well as dynamic
1212
sleeping.
1313

1414
The philosopher always tries to get the lowest fork first (f1 then f2). When done, he will give
15-
back the forks in the reverse order (f2 then f1). If he gets two forks, he is EATING. Otherwise,
16-
he is THINKING. Transitional states are shown as well, such as STARVING when the philosopher is
17-
hungry but the forks are not available, and HOLDING ONE FORK when a philosopher is waiting for the
18-
second fork to be available.
15+
back the forks in the reverse order (f2 then f1). If he gets two forks, he is ``EATING``.
16+
Otherwise, he is ``THINKING``. Transitional states are shown as well, such as ``STARVING`` when the
17+
philosopher is hungry but the forks are not available, and ``HOLDING ONE FORK`` when a philosopher
18+
is waiting for the second fork to be available.
1919

20-
Each Philosopher will randomly alternate between the EATING and THINKING state.
20+
Each Philosopher will randomly alternate between the ``EATING`` and ``THINKING`` states.
2121

22-
It is possible to run the demo in coop-only or preempt-only mode. To achieve this, set these values
23-
for CONFIG_NUM_COOP_PRIORITIES and CONFIG_NUM_PREEMPT_PRIORITIES in prj.conf:
22+
It is possible to run the demo in `coop-only` or `preempt-only` mode. To achieve this, set these
23+
values for ``CONFIG_NUM_COOP_PRIORITIES`` and ``CONFIG_NUM_PREEMPT_PRIORITIES`` in :file:`prj.conf`:
2424

25-
preempt-only:
25+
preempt-only
26+
.. code-block:: cfg
2627
27-
CONFIG_NUM_PREEMPT_PRIORITIES 6
28-
CONFIG_NUM_COOP_PRIORITIES 0
28+
CONFIG_NUM_PREEMPT_PRIORITIES=6
29+
CONFIG_NUM_COOP_PRIORITIES=0
2930
30-
coop-only:
3131
32-
CONFIG_NUM_PREEMPT_PRIORITIES 0
33-
CONFIG_NUM_COOP_PRIORITIES 6
32+
coop-only
33+
.. code-block:: cfg
34+
35+
CONFIG_NUM_PREEMPT_PRIORITIES=0
36+
CONFIG_NUM_COOP_PRIORITIES=6
3437
3538
In these cases, the philosopher threads will run with priorities 0 to 5 (preempt-only) and -7 to -2
3639
(coop-only).
@@ -50,7 +53,7 @@ This project outputs to the console. It can be built and executed on QEMU as fo
5053
Sample Output
5154
=============
5255

53-
.. code-block:: console
56+
.. code-block::
5457
5558
Philosopher 0 [P: 3] HOLDING ONE FORK
5659
Philosopher 1 [P: 2] HOLDING ONE FORK
@@ -78,7 +81,7 @@ tools like OpenOCD and J-link to inspect thread data using ``info threads``.
7881
OpenOCD Sample Output
7982
=====================
8083

81-
.. code-block:: console
84+
.. code-block::
8285
8386
Thread 1 received signal SIGINT, Interrupt.
8487
[Switching to Thread 537003160]
@@ -100,7 +103,7 @@ OpenOCD Sample Output
100103
Info : Getting thread 537002104 reg list
101104
7 Thread 537002104 (Name: Philosopher 0, prio:3,useropts:4) 0x08001404 in arch_irq_unlock (key=0) at zephyr/mainline/zephyr/include/arch/arm/asm_inline_gcc.h:95
102105
103-
.. code-block:: console
106+
.. code-block::
104107
105108
Philosopher 0 [P: 3] STARVING
106109
Philosopher 1 [P: 2] HOLDING ONE FORK
@@ -113,7 +116,7 @@ OpenOCD Sample Output
113116
J-Link Sample Output
114117
====================
115118

116-
.. code-block:: console
119+
.. code-block::
117120
118121
Thread 2 received signal SIGTRAP, Trace/breakpoint trap.
119122
[Switching to Thread 537920592]
@@ -129,7 +132,7 @@ J-Link Sample Output
129132
7 Thread 537920240 (Philosopher 4 PENDING PRIO 255) arch_swap (key=0) at zephyr/mainline/zephyr/arch/arm/core/swap.c:53
130133
8 Thread 537920416 (Philosopher 5 SUSPENDED PRIO 254) arch_swap (key=key@entry=0) at zephyr/mainline/zephyr/arch/arm/core/swap.c:53
131134
132-
.. code-block:: console
135+
.. code-block::
133136
134137
Philosopher 0 [P: 3] STARVING
135138
Philosopher 1 [P: 2] EATING [ 475 ms ]

0 commit comments

Comments
 (0)