Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 29s8 days 9 hours 54 minutes 29 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 29s8 days 9 hours 54 minutes 29 seconds.

Sign in to watch this lesson
Waiting and Signalling · 4:19
A semaphore is a count with two operations, wait (P) and post (V), and its initial value turns it into a lock, an ordering or a throttle. We reproduce the operating systems book's value trace, use C++20 std::counting_semaphore on a Mac (where POSIX sem_init is not implemented), deadlock the bounded buffer by holding the mutex while waiting, and then find that this Mac's libc++ semaphore occasionally loses a wakeup, while one built from a mutex and a condition variable never did.