3 ms·
I think the point is that semaphore calls might be expensive, while in the normal case this is a simple one-instruction atomic increment.
by tlb 12y ago
I think the point is that semaphore calls might be expensive, while in the normal case this is a simple one-instruction atomic increment.
- kazinator 12y agoMy point, on the other hand, is that this one-instruction atomic increment and test, with a conditional wait call is a semaphore (though perhaps a faster one than the underlying semaphore). Whereas the point of the article is that semaphores are very flexible and can be used to implement other primitives. This could be repaired by reframing the example as "look, slow semaphores, together with an atomic increment/test operation provided by the processor, can be used to implement faster semaphores!" This is actually a useful case that tends to be overlooked by "primitives X, Y, and Z out of semaphores" tutorials.