kernel/services/threads/nothread.html · kernel/services/threads/nothread.rst 공식 원문 ↗

Zephyr 3.7.0 · Kernel · Threads

Thread 없이 동작하기

작은 bootloader와 event-driven application에서 thread를 제거할 때 남는 기능 경계를 명확히 합니다.

Official pathkernel/services/threads/nothread.html
Source filekernel/services/threads/nothread.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Boot·interrupt·clock·timer·memory는 유지되지만 scheduler·workqueue·동기화 API 대부분은 제외됩니다.

유지

boot · IRQ · clock

제외

thread · queue · sync

Driver

SoC flash · GPIO · UART

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 003B39F486B509D832850095763888517448BB612C5EDDC93725627B02AAF7B0
.. _nothread:

Operation without Threads
#########################

Thread support is not necessary in some applications:

* Bootloaders
* Simple event-driven applications
* Examples intended to demonstrate core functionality

Thread support can be disabled by setting
:kconfig:option:`CONFIG_MULTITHREADING` to ``n``.  Since this configuration has
a significant impact on Zephyr's functionality and testing of it has
been limited, there are conditions on what can be expected to work in
this configuration.

What Can be Expected to Work
****************************

These core capabilities shall function correctly when
:kconfig:option:`CONFIG_MULTITHREADING` is disabled:

* The :ref:`build system <application>`

* The ability to boot the application to ``main()``

* :ref:`Interrupt management <interrupts_v2>`

* The system clock including :c:func:`k_uptime_get`

* Timers, i.e. :c:func:`k_timer`

* Non-sleeping delays e.g. :c:func:`k_busy_wait`.

* Sleeping :c:func:`k_cpu_idle`.

* Pre ``main()`` drivers and subsystems initialization e.g. :c:macro:`SYS_INIT`.

* :ref:`kernel_memory_management_api`

* Specifically identified drivers in certain subsystems, listed below.

The expectations above affect selection of other features; for example
:kconfig:option:`CONFIG_SYS_CLOCK_EXISTS` cannot be set to ``n``.

What Cannot be Expected to Work
*******************************

Functionality that will not work with :kconfig:option:`CONFIG_MULTITHREADING`
includes majority of the kernel API:

* :ref:`threads_v2`

* :ref:`scheduling_v2`

* :ref:`workqueues_v2`

* :ref:`polling_v2`

* :ref:`semaphores_v2`

* :ref:`mutexes_v2`

* :ref:`condvar`

* :ref:`kernel_data_passing_api`

.. contents::
    :local:
    :depth: 1

Subsystem Behavior Without Thread Support
*****************************************

The sections below list driver and functional subsystems that are
expected to work to some degree when :kconfig:option:`CONFIG_MULTITHREADING` is
disabled.  Subsystems that are not listed here should not be expected to
work.

Some existing drivers within the listed subsystems do not work when
threading is disabled, but are within scope based on their subsystem, or
may be sufficiently isolated that supporting them on a particular
platform is low-impact.  Enhancements to add support to existing
capabilities that were not originally implemented to work with threads
disabled will be considered.

Flash
=====

The :ref:`flash_api` is expected to work for all SoC flash peripheral
drivers.  Bus-accessed devices like serial memories may not be
supported.

*List/table of supported drivers to go here*

GPIO
====

The :ref:`gpio_api` is expected to work for all SoC GPIO peripheral
drivers.  Bus-accessed devices like GPIO extenders may not be supported.

*List/table of supported drivers to go here*

UART
====

A subset of the :ref:`uart_api` is expected to work for all SoC UART
peripheral drivers.

* Applications that select :kconfig:option:`CONFIG_UART_INTERRUPT_DRIVEN` may
  work, depending on driver implementation.

* Applications that select :kconfig:option:`CONFIG_UART_ASYNC_API` may
  work, depending on driver implementation.

* Applications that do not select either :kconfig:option:`CONFIG_UART_ASYNC_API`
  or :kconfig:option:`CONFIG_UART_INTERRUPT_DRIVEN` are expected to work.

*List/table of supported drivers to go here, including which API options
are supported*

Part 3

한국어 전문 번역

일부 application에는 thread 지원이 필요하지 않습니다. 대표적으로 bootloader, 단순 event-driven application, 핵심 기능만 보여 주는 example이 이에 해당합니다.

CONFIG_MULTITHREADING을 n으로 설정하면 thread 지원을 끌 수 있습니다. 이 설정은 Zephyr 기능 전반에 큰 영향을 주고 시험 범위도 제한되어 있으므로, 아래에 명시된 범위만 동작을 기대해야 합니다.

동작을 기대할 수 있는 기능

CONFIG_MULTITHREADING이 꺼져 있어도 다음 핵심 기능은 올바르게 동작해야 합니다.

  • Application build system
  • Application을 boot해 main()까지 진입하는 기능
  • Interrupt management
  • k_uptime_get()을 포함한 system clock
  • k_timer timer
  • k_busy_wait() 같은 sleep하지 않는 delay
  • k_cpu_idle() sleep
  • SYS_INIT() 같은 main() 이전 driver·subsystem initialization
  • Kernel memory management API
  • 아래 subsystem에서 명시적으로 식별된 driver

이 보장 범위는 다른 feature 선택에도 영향을 줍니다. 예를 들어 CONFIG_SYS_CLOCK_EXISTS는 n으로 설정할 수 없습니다.

동작을 기대할 수 없는 기능

CONFIG_MULTITHREADING이 꺼지면 kernel API의 대부분은 동작하지 않습니다. Thread, scheduling, workqueue, polling, semaphore, mutex, condition variable, kernel data passing API가 여기에 포함됩니다.

Thread 비활성 구성의 경계
유지

build · boot to main · interrupt · clock · timer · memory

제한

flash · GPIO · UART의 일부 driver

제외

thread · scheduler · workqueue · poll · synchronization · data passing

목록에 없는 subsystem은 동작을 기대하면 안 됩니다.

Thread 지원이 없을 때의 subsystem 동작

아래 section은 CONFIG_MULTITHREADING을 끈 상태에서도 어느 정도 동작할 것으로 기대되는 driver·functional subsystem을 나열합니다. 목록에 없는 subsystem은 지원된다고 가정하면 안 됩니다.

목록에 든 subsystem 안에도 threading 없이 동작하지 않는 기존 driver가 있을 수 있습니다. 다만 subsystem 범위에 들어가거나 특정 platform에서 지원 비용이 낮다면 개선 대상으로 검토할 수 있습니다. 원래 thread 없는 구성을 지원하지 않았던 기존 기능에 지원을 추가하는 enhancement도 고려됩니다.

Flash

모든 SoC flash peripheral driver는 flash API가 동작할 것으로 기대합니다. Serial memory처럼 bus를 통해 접근하는 device는 지원되지 않을 수 있습니다.

지원 driver 목록·표는 원문에서도 추후 작성할 자리로 남아 있습니다.

GPIO

모든 SoC GPIO peripheral driver는 GPIO API가 동작할 것으로 기대합니다. GPIO extender처럼 bus-accessed device는 지원되지 않을 수 있습니다.

지원 driver 목록·표는 원문에서도 추후 작성할 자리로 남아 있습니다.

UART

모든 SoC UART peripheral driver에서는 UART API 일부가 동작할 것으로 기대합니다.

  • CONFIG_UART_INTERRUPT_DRIVEN을 선택한 application은 driver 구현에 따라 동작할 수 있습니다.
  • CONFIG_UART_ASYNC_API를 선택한 application도 driver 구현에 따라 동작할 수 있습니다.
  • 두 option을 모두 선택하지 않은 application은 동작할 것으로 기대합니다.

지원 driver와 각 driver가 제공하는 API option 목록·표는 원문에서도 추후 작성할 자리로 남아 있습니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.