세마포어
공유 자원 접근을 제어하는 카운터 기반 동기화.
A semaphore is a more flexible synchronization tool than a mutex. It maintains a counter representing the number of available resources. The 'wait' operation decrements the counter, and the 'signal' (or post) operation increments it. A binary semaphore (counter 0 or 1) functions similarly to a mutex.
graph LR
Center["세마포어"]:::main
Rel_mutex["mutex"]:::related -.-> Center
click Rel_mutex "/terms/mutex"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧠 지식 테스트
1 / 1
🧒 5살도 이해할 수 있게 설명
주차장의 남은 자리 표시기와 같습니다. 자리가 있으면 들어가고 숫자가 줄어듭니다. 0이면 기다립니다.
🤓 Expert Deep Dive
뮤텍스와 달리 소유권이 없어 스레드 간 신호 전달에 유용합니다 (생산자-소비자 패턴).