Part 1
요약·해설
작은 sensor node부터 복잡한 wireless gateway까지 공통으로 사용하는 kernel service와 객체 선택 기준을 정리합니다.
Thread · scheduler · interrupt
Semaphore · mutex · event
Queue · mailbox · pipe · timer
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
5502C8A24B059F47C980E86116CC0FED55248D17F90AA32F77DA0A7342BDABF8
.. _kernel_api:
Kernel Services
###############
The Zephyr kernel lies at the heart of every Zephyr application. It provides
a low footprint, high performance, multi-threaded execution environment
with a rich set of available features. The rest of the Zephyr ecosystem,
including device drivers, networking stack, and application-specific code,
uses the kernel's features to create a complete application.
The configurable nature of the kernel allows you to incorporate only those
features needed by your application, making it ideal for systems with limited
amounts of memory (as little as 2 KB!) or with simple multi-threading
requirements (such as a set of interrupt handlers and a single background task).
Examples of such systems include: embedded sensor hubs, environmental sensors,
simple LED wearable, and store inventory tags.
Applications requiring more memory (50 to 900 KB), multiple communication
devices (like Wi-Fi and Bluetooth Low Energy), and complex multi-threading,
can also be developed using the Zephyr kernel. Examples of such systems
include: fitness wearables, smart watches, and IoT wireless gateways.
Scheduling, Interrupts, and Synchronization
*******************************************
These pages cover basic kernel services related to thread scheduling and
synchronization.
.. toctree::
:maxdepth: 1
threads/index.rst
scheduling/index.rst
threads/system_threads.rst
threads/workqueue.rst
threads/nothread.rst
interrupts.rst
polling.rst
synchronization/semaphores.rst
synchronization/mutexes.rst
synchronization/condvar.rst
synchronization/events.rst
smp/smp.rst
.. _kernel_data_passing_api:
Data Passing
************
These pages cover kernel objects which can be used to pass data between
threads and ISRs.
The following table summarizes their high-level features.
=============== ============== =================== ============== ============== ================= ============== ===============================
Object Bidirectional? Data structure Data item size Data Alignment ISRs can receive? ISRs can send? Overrun handling
=============== ============== =================== ============== ============== ================= ============== ===============================
FIFO No Queue Arbitrary [1] 4 B [2] Yes [3] Yes N/A
LIFO No Queue Arbitrary [1] 4 B [2] Yes [3] Yes N/A
Stack No Array Word Word Yes [3] Yes Undefined behavior
Message queue No Ring buffer Arbitrary [6] Power of two Yes [3] Yes Pend thread or return -errno
Mailbox Yes Queue Arbitrary [1] Arbitrary No No N/A
Pipe No Ring buffer [4] Arbitrary Arbitrary Yes [5] Yes [5] Pend thread or return -errno
=============== ============== =================== ============== ============== ================= ============== ===============================
[1] Callers allocate space for queue overhead in the data
elements themselves.
[2] Objects added with k_fifo_alloc_put() and k_lifo_alloc_put()
do not have alignment constraints, but use temporary memory from the
calling thread's resource pool.
[3] ISRs can receive only when passing K_NO_WAIT as the timeout
argument.
[4] Optional.
[5] ISRS can send and/or receive only when passing K_NO_WAIT as the
timeout argument.
[6] Data item size must be a multiple of the data alignment.
.. toctree::
:maxdepth: 1
data_passing/queues.rst
data_passing/fifos.rst
data_passing/lifos.rst
data_passing/stacks.rst
data_passing/message_queues.rst
data_passing/mailboxes.rst
data_passing/pipes.rst
.. _kernel_memory_management_api:
Memory Management
*****************
See :ref:`memory_management_api`.
Timing
******
These pages cover timing related services.
.. toctree::
:maxdepth: 1
timing/clocks.rst
timing/timers.rst
Other
*****
These pages cover other kernel services.
.. toctree::
:maxdepth: 1
other/atomic.rst
other/float.rst
other/version.rst
other/fatal.rst
other/thread_local_storage.rst
Part 3
한국어 전문 번역
커널 서비스
Zephyr 커널은 모든 Zephyr 애플리케이션의 중심에 있습니다. 커널은 사용할 수 있는 풍부한 기능과 함께 작은 설치 공간, 높은 성능의 다중 스레드 실행 환경을 제공합니다. 장치 드라이버, 네트워킹 스택, 애플리케이션별 코드를 포함한 나머지 Zephyr 생태계는 완전한 애플리케이션을 만들기 위해 커널 기능을 사용합니다.
커널을 설정할 수 있다는 특성 덕분에 애플리케이션에 필요한 기능만 포함할 수 있습니다. 따라서 메모리가 제한된 시스템(적게는 2 KB)이나 단순한 다중 스레드 요구 사항(예: 여러 interrupt handler와 하나의 background task)을 가진 시스템에 이상적입니다. 이러한 시스템의 예로 embedded sensor hub, 환경 센서, 단순 LED wearable, 매장 재고 tag가 있습니다.
더 많은 메모리(50~900 KB), 여러 통신 장치(예: Wi-Fi와 Bluetooth Low Energy), 복잡한 다중 스레드 처리가 필요한 애플리케이션도 Zephyr 커널로 개발할 수 있습니다. 이러한 시스템의 예로 fitness wearable, smart watch, IoT wireless gateway가 있습니다.
스케줄링, 인터럽트, 동기화
다음 페이지에서는 thread scheduling과 synchronization에 관련된 기본 커널 서비스를 다룹니다.
- 스레드(Threads)
- 스케줄링(Scheduling)
- CPU 유휴 상태(CPU Idling)
- 시스템 스레드(System Threads)
- 워크큐 스레드(Workqueue Threads)
- 스레드 없이 동작하기(Operation without Threads)
- 인터럽트(Interrupts)
- 폴링 API(Polling API)
- 세마포어(Semaphores)
- 뮤텍스(Mutexes)
- 조건 변수(Condition Variables)
- 이벤트(Events)
- 대칭형 다중 처리(Symmetric Multiprocessing)
데이터 전달
다음 페이지에서는 thread와 ISR 사이에서 데이터를 전달하는 데 사용할 수 있는 커널 객체를 다룹니다.
다음 표는 이 객체들의 상위 수준 특성을 요약합니다.
| 객체 | 양방향? | 자료 구조 | 데이터 항목 크기 | 데이터 정렬 | ISR 수신 가능? | ISR 송신 가능? | 초과 처리 |
|---|---|---|---|---|---|---|---|
| FIFO | 아니요 | Queue | 임의 [1] | 4 B [2] | 예 [3] | 예 | 해당 없음 |
| LIFO | 아니요 | Queue | 임의 [1] | 4 B [2] | 예 [3] | 예 | 해당 없음 |
| Stack | 아니요 | Array | Word | Word | 예 [3] | 예 | 정의되지 않은 동작 |
| Message queue | 아니요 | Ring buffer | 임의 [6] | 2의 거듭제곱 | 예 [3] | 예 | thread를 대기시키거나 -errno 반환 |
| Mailbox | 예 | Queue | 임의 [1] | 임의 | 아니요 | 아니요 | 해당 없음 |
| Pipe | 아니요 | Ring buffer [4] | 임의 | 임의 | 예 [5] | 예 [5] | thread를 대기시키거나 -errno 반환 |
[1] 호출자는 데이터 항목 자체에 queue 관리 오버헤드를 위한 공간을 할당합니다.
[2] k_fifo_alloc_put()과 k_lifo_alloc_put()으로 추가한 객체에는 정렬 제약이 없지만, 호출 thread의 resource pool에서 임시 메모리를 사용합니다.
[3] ISR은 timeout 인자로 K_NO_WAIT를 전달할 때만 수신할 수 있습니다.
[4] 선택 사항입니다.
[5] ISR은 timeout 인자로 K_NO_WAIT를 전달할 때만 송신 또는 수신할 수 있습니다.
[6] 데이터 항목 크기는 데이터 정렬 단위의 배수여야 합니다.
- 큐(Queues)
- FIFO
- LIFO
- 스택(Stacks)
- 메시지 큐(Message Queues)
- 메일박스(Mailboxes)
- 파이프(Pipes)
메모리 관리
메모리 관리(Memory Management)를 참조하십시오.
타이밍
다음 페이지에서는 시간 관련 서비스를 다룹니다.
- 커널 타이밍(Kernel Timing)
- 타이머(Timers)
기타
다음 페이지에서는 그 밖의 커널 서비스를 다룹니다.
- 원자적 서비스(Atomic Services)
- 부동소수점 서비스(Floating Point Services)
- 버전(Version)
- 치명적 오류(Fatal Errors)
- 스레드 로컬 저장소(Thread Local Storage, TLS)
Source
출처
원문 파일의 단락, directive, 표, 코드, symbol, 경로는 영어 원문 영역에 그대로 보존했습니다.