Part 1
요약·해설
Zephyr 고유 구현과 같은 동기화 문제를 POSIX API variant로 실행하고 비교합니다.
API
POSIX threads
Board
qemu_riscv64
Debug
CONFIG_DEBUG_THREAD_INFO
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
원문 SHA-256
C7353C181BD0E96D4E347DC9E4C1A9977C41856C291FD37415FFB041243CEED9
.. _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>`.
Part 3
한국어 전문 번역
개요
이 sample은 Zephyr Dining Philosophers sample을 POSIX API로 구현합니다. Source code는 samples/posix/philosophers에서 찾을 수 있습니다.
빌드 및 실행
이 project는 console에 결과를 출력합니다. QEMU에서 다음과 같이 build하고 실행할 수 있습니다.
west build -b qemu_riscv64 samples/posix/philosophers
west build -t run
출력 예
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 ]
CTRL+A를 누른 다음 x를 눌러 QEMU를 종료합니다.
디버깅
원래 philosophers sample과 마찬가지로 POSIX variant도 기본적으로 CONFIG_DEBUG_THREAD_INFO를 활성화합니다.
west build -b <board_name> samples/philosophers
west debug
추가 정보
자세한 내용은 Dining Philosophers sample을 참고하십시오.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.