From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-06-03 20:50:59
At 06:27 PM 5/25/2002, Jive Dadson wrote:
>I'd like to ask a favor of you folks. Can anyone point me to an essay,
>USNIX article, FAQ, or whatever that contains a lucid description and
>*examples* of the horrors which await those who use semaphores? I'd
>like to understand just what all the brouhaha is about.
If you are a member of the ACM digital library, take a look at Section 3.3
of "Concepts and Notations for Concurrent Programming", Computing Surveys,
Vol. 15, No.1, Match, 1983.
Much seminal work on constructs to replace semaphores was done by C.A.R.
Hoare (now Sir Tony I guess, since he has been knighted) and Per Brinch
Hansen in the early 1970's. If you put their names and "semaphore" into
Google, you can find various material, although I didn't see anything
exactly answering your questions.
>It is clear to me that, on the face of it, condvars are more general. I
>say, "on the face of it," because the fact that Boost.Threads implements
>condvars in terms of MS Windows CRITICAL_SECTION's and semaphores,
>albeit inefficiently, demonstrates that the two mechanisms have equal
>power. 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.
It's somewhat like goto statements or global variables. Some programmers
used them for years without problems, and wondered what all the
"structured-programming" fuss was all about. But for most of us, staying
clear of them reduced error rates and increased code maintainability.
Hope that helps.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk