remzi-arpacidusseau / ostep-typos

51 stars 44 forks source link

Mismatch between posix/linux description of semaphores and the description mentioned in the book #85

Open 0xGodspeed opened 12 months ago

0xGodspeed commented 12 months ago

About Chapter 31, Semaphores. The description of semaphores and semaphore unlock(wait) operation in the book is different from the POSIX standard The POSIX standard states that the value of a semaphore never falls below 0. ^1 But the book states that they can be negative. Also, in the unlock (wait) operation, the book states that the value is decremented by one regardless of the current value it possesses or whether it is zero, unlike in POSIX. I think the book follows the original definitions as described by Dijkstra and others. Still, the problem is that it claims to describe the POSIX compliant definitions when it does not. I think it is important to make a distinction between the two.