Saul wrote:
> Hi
> I've seen a couple of times posts (at this newsgroup) along the lines:
> "The use of events (As opposed to condition variables) for
> synchronization of threads is hard to use correctly"
> It was also noted that the comparison of events & cv's was studied in
> the 1970's.
> Where did these studies appear?
Here is a few links that perhaps might help..
http://www.acm.org/classics/feb96
http://www.acm.org/pubs/citations/journals/surveys/1973-5-4/p223-hansen
ftp://gatekeeper.research.compaq.com/pub/DEC/SRC/research-reports/SRC...
http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/condvar.c?cvsro...
http://groups.google.com/groups?as_umsgid=3AEAC433.1595...@web.de
(implementing POSIX-CV under windows; problem of
SignalAndWait/PulseEvent
and MS-thread model with respect to suspended thread state)
http://www.opengroup.org/austin
(POSIX Draft 7 (Proposed Final Text) Specifications):
"Much experience with semaphores shows that there are two
distinct uses of synchronization: locking, which is typically
of short duration; and waiting, which is typically of long or
unbounded duration. These distinct usages map directly onto
mutexes and condition variables, respectively."
"Mutexes and condition variables have been effectively used with
and without priority inheritance, priority ceiling, and other
attributes to synchronize threads that share memory. The
efficiency of their implementation is comparable to or better
than that of other synchronization primitives that are sometimes
harder to use (for example, binary semaphores[1]). Furthermore,
there is at least one known implementation of Ada tasking that
uses these primitives.
Mutexes and condition variables together constitute an
appropriate, sufficient, and complete set of inter-thread[2]
synchronization primitives."
[1] MS:auto-reset event/counting semaphore with value/count
initially set to 0 or 1 and that never become "> 1";
[2] share process memory/address space; or inter-process
synchronization (PROCESS_SHARED mutexes/cvs) for
processes that share some memory (memory that can be
mapped concurrently into the address space of more
than one process).
regards,
alexander.