Boost logo

Boost :

From: Victor A. Wagner, Jr. (vawjr_at_[hidden])
Date: 2002-05-26 11:21:46

At Saturday 2002/05/25 15:27, you wrote:

> What is not clear to me is why some people call semaphores "BAD"
>in all caps. I've used them since 1979 without any disasters so far.
>I want to emphasize that I am asking for my own education, not to stir
>up trouble. With that in mind, I suggest that "these proceedings are
>closed." If you would be kind enough to do me a favor and direct my
>attention to some article that has examples of the semaphore's dark
>side, please email me at

The first real-time embedded kernel I ever worked with was architected and
implemented in 1972. I re-implemented it in its entirety in 1973 (I worked
for the mini-computer manufacturer for whom it had been originally
written). It had two synchronization methods, semaphore and mailbox
(basically a semaphore with 32bits of data added at 'signal' time to be
given to the "waiting" thread).
for the next 18 years, those two methods were the basis for all the other
synchronizers in the embedded real-time systems which we wrote. I don't
recall any instances of them being "mis-used" or being considered
"dangerous". We had more problems with the engineers attempting to put
together instruction sets which wouldn't allow us to write a semaphore,
than we had with the semaphores (or their users). We even had "global"
semaphores (signal by any thread/process, wait by any thread/process)
These systems were used to build systems on which people's lives depended,
so either we were "very lucky" or maybe they're not so hazardous as people
OTOH, we had absolute control over the computers on which they executed,
AND we had "instruction help" to ensure that we COULD gain (and hold)
access to all the busses (even the multi-processor models) for shareable
items (like a region of memory) for the time necessary to do the "critical"
The people who write high-level languages have apparently never worked in
such an environment (an atomic test/set (exchange w/ memory works fine)
which, of course, we had), because HLLs don't seem to have the operators
necessary to describe such things(we still don't even have a plain swap
operator, let alone atomic). So we're stuck with people attempting to
implement things in HLLs which are inherently not "sayable". I believe
this is what causes the current dilemma about "thread safety", we're trying
to say something without a proper vocabulary.

If you do get some info on the hazards, could you please forward it to me?

To paraphrase the king of Siam: " 'Tis a bafflement. "

Victor A. Wagner Jr.
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"

Boost list run by bdawes at, gregod at, cpdaniel at, john at