semaphore littleCat 2023-03-01 52 阅读1分钟 Goal optimize for uncontended (common) case Implementation idea Uncontended case: use atomic operations Contended case: use spin locks and wait queues Linux semaphore structure