zephyr/samples/posix/philosophers
Christopher Friedt dd33a8152a samples: philosophers: remove redundant items in prj.conf
The normal and posix philosophers samples seemed to have
a number of redundant choices in prj.conf.

Let's reduce to the minimum required for the sample. The
CONFIG_DEBUG_THREAD_INFO option is part of the
documentation, so leave it as-is.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-02-01 05:26:24 -05:00
..
src samples: posix: philosophers: fix off-by-one error 2024-02-01 05:26:24 -05:00
CMakeLists.txt
Kconfig
README.rst samples: posix: philosophers: minor spacing corrections 2024-02-01 05:26:24 -05:00
prj.conf samples: philosophers: remove redundant items in prj.conf 2024-02-01 05:26:24 -05:00
sample.yaml

README.rst

.. _posix-philosophers-sample:

POSIX Philosophers
##################

Overview
********

This sample implements Zephyr's :ref:`Dining Philosophers Sample <dining-philosophers-sample>` using the
:ref:`POSIX API <posix_support>`. The source code for this sample can be found under
:file:`samples/posix/philosophers`.

Building and Running
********************

This project outputs to the console. It can be built and executed on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/posix/philosophers
   :host-os: unix
   :board: qemu_riscv64
   :goals: run
   :compact:

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 ]

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.

Debugging
*********

Like the original philosophers sample, the POSIX variant also enables
:kconfig:option:`CONFIG_DEBUG_THREAD_INFO` by default.

.. zephyr-app-commands::
   :zephyr-app: samples/philosophers
   :host-os: unix
   :board: <board_name>
   :goals: debug
   :compact:

Additional Information
**********************

For additional information, please refer to the
:ref:`Dining Philosophers Sample <dining-philosophers-sample>`.