오늘은 critical section problem을 해결할 수 있는 HW support 방법 중 하나인 Semaphore에 대해서 알아봅시다. Semaphore semaphore는 이전 글에서 소개드린 testset의 단점인 busy waiting을 해결하고, bounded waiting 또한 깔끔하게 해결할 수 있는 방식입니다. testset과 마찬가지로, semaphore도 atomic operation을 이용하여 critical section problem을 해결합니다. Semaphore는 하나의 정수와, 큐를 갖는 구조를 의미합니다. 이들의 쓰임은 아래에서 확인합시다. Semaphore에서는 특별한 함수 semWait(s)과 semSignal(s)을 사용합니다. semWait(s)은 semaph..