kernel/data_structures/mpsc_lockfree.html · kernel/data_structures/mpsc_lockfree.rst 공식 원문 ↗

Zephyr 3.7.0 · Kernel · Data Structures

MPSC Lock-free Queue

여러 producer가 넣고 하나의 consumer가 꺼내는 lock-free intrusive queue입니다.

Official pathkernel/data_structures/mpsc_lockfree.html
Source filekernel/data_structures/mpsc_lockfree.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

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

Part 1

요약·해설

Atomic pointer swap을 사용하며 queue 초기화, push, pop과 node·queue 구조체 API를 제공합니다.

Producers

Multiple

Consumer

Single

Sync

Atomic pointer swap

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 4397884F938B46D3E6B40A582E155A273158CC49FCDF2001A3C4B7285F6C3EED
.. _mpsc_lockfree:

Multi Producer Single Consumer Lock Free Queue
==============================================

A :dfn:`Multi Producer Single Consumer Lock Free Queue (MPSC)` is an lockfree
intrusive queue based on atomic pointer swaps as described by Dmitry Vyukov
at `1024cores <https://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue>`_.


API Reference
*************

.. doxygengroup:: mpsc_lockfree

Part 3

한국어 전문 번역

MPSC(Multi Producer Single Consumer Lock Free Queue)는 Dmitry Vyukov가 1024cores에서 설명한 atomic pointer swap 기반의 lock-free intrusive queue입니다.

API 참고

API group mpsc_lockfree은 여러 producer와 하나의 consumer를 위한 MPSC lock-free queue API입니다.

매크로와 정의

mpsc_ptr_get(ptr)

Atomic pointer 값을 읽습니다.

mpsc_ptr_set(ptr, val)

Atomic pointer에 값을 설정합니다.

mpsc_ptr_set_get(ptr, val)

Atomic pointer에 새 값을 설정하고 이전 값을 얻습니다.

MPSC_INIT(symbol)

MPSC queue를 정적으로 초기화합니다. 공식 생성 문서의 뒤 문장은 'Since the queue is'에서 끝납니다.

매개변수

  • symbol: queue 이름

형식 별칭

typedef atomic_ptr_t mpsc_ptr_t

MPSC가 사용하는 atomic pointer 형식입니다.

함수

static inline void mpsc_init(struct mpsc *q)

Queue를 초기화하거나 초기 상태로 되돌립니다.

매개변수

  • q: 초기화하거나 reset할 queue
ALWAYS_INLINE static void mpsc_push(struct mpsc *q, struct mpsc_node *n)

Node를 queue에 넣습니다.

매개변수

  • q: node를 넣을 queue
  • n: queue에 넣을 node
static inline struct mpsc_node *mpsc_pop(struct mpsc *q)

목록에서 node 하나를 꺼냅니다.

매개변수

  • q: node를 꺼낼 queue

반환값: NULL은 사용 가능한 node가 없음을 뜻하고, 그렇지 않으면 사용 가능한 node를 반환합니다.

구조체

struct mpsc_node

<mpsc_lockfree.h>에 정의된 queue member입니다.

struct mpsc

<mpsc_lockfree.h>에 정의된 MPSC queue입니다.

Source

출처

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