1.. zephyr:code-sample:: synchronization 2 :name: Basic Synchronization 3 :relevant-api: thread_apis semaphore_apis 4 5 Manipulate basic kernel synchronization primitives. 6 7Overview 8******** 9 10A simple application that demonstrates basic sanity of the kernel. 11Two threads (A and B) take turns printing a greeting message to the console, 12and use sleep requests and semaphores to control the rate at which messages 13are generated. This demonstrates that kernel scheduling, communication, 14and timing are operating correctly. 15 16Building and Running 17******************** 18 19This project outputs to the console. It can be built and executed 20on QEMU as follows: 21 22.. zephyr-app-commands:: 23 :zephyr-app: samples/synchronization 24 :host-os: unix 25 :board: qemu_x86 26 :goals: run 27 :compact: 28 29Sample Output 30============= 31 32.. code-block:: console 33 34 threadA: Hello World! 35 threadB: Hello World! 36 threadA: Hello World! 37 threadB: Hello World! 38 threadA: Hello World! 39 threadB: Hello World! 40 threadA: Hello World! 41 threadB: Hello World! 42 threadA: Hello World! 43 threadB: Hello World! 44 45 <repeats endlessly> 46 47Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`. 48