컴퓨터/운영체제 OS

Condition Variable - 변수가 아니라고?

나한나한나한나 2024. 5. 19. 20:56

부득이하게 임계 영역 안에서 block을 해야 하는 경우에 그것을 도와주는 부수적인 매커니즘

조건 변수는 변수가 아니다

그럼 뭐냐? -> waiting queue다

  • An event having two operations that are performed on itself
    • wait(c), signal(c)
    • A thread waits for an event to occur using wait(c)
    • A thread wakes up another thread waiting on an event using signal(c)
  • condvar의 wait()에는 condvar 뿐만 아니라 mutex(semaphore)도 parameter로 와야 한다.