New essay: The Best Synchronization is No Synchronization



In response to an earlier post saying that messages should not be used for synchronization
and that primitives like mutexes, events, and semaphores were better suited, (note also
that CRITICAL_SECTIONs had been omitted from the list, probably an oversight, and timers
had been included, for reasons I cannot ascertain because timers have nothing to do with
synchronization). I offer a counterargument: these primitives are the assembly code of
synchronization, and mechanisms like messages and I/O Completion Ports provide much better
alternatives most of the time. We should be searching for higher-level mechanisms.

I discuss two of my favorite non-synchronization mechanisms for mutual exclusion: the
Positive Handoff Protocol and the Central Controller Protocol, both of which are easier to
use and neither of which uses an event, semaphore, mutex, or CRITICAL_SECTION. I also
suggest that when these *are* needed they should be hidden inside classes so the
programmer never needs to see them.

http://www.flounder.com/no_synchronization.htm
joe
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: New essay: The Best Synchronization is No Synchronization
    ... synchronization). ... We should be searching for higher-level mechanisms. ... Positive Handoff Protocol and the Central Controller Protocol, both of which are easier to ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Adding thread support for C...
    ... What you won't get is support for writing your own synchronization api's, Not unless you can construct them out of the synchronization functions they give you. ... of threading api implementors to have a low opinion of other peoples ... primitives dependent on particular machine-level shared memory models, ...
    (comp.programming.threads)
  • Re: interprocess communciation
    ... - message queue: synchronization and information exchange between 2 ... - events: synchronization between 2 processes/threads. ... > synchronisation mechanisms in windows ce. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: thread memory size
    ... the *only* benefit to prohibiting the use of other synchronization ... mechanisms. ... So why are you asking about threads which do have to share memory? ...
    (comp.os.linux.development.system)
  • Limits of number of Locks/Monitors (a.k.a. java.lang.Object)
    ... there is a max number synchronization ... objects (semaphores etc.) that one can create. ... Now, each java object provides the Monitor functionality, and I ... synchronization objects than the underlying threading environment can ...
    (comp.lang.java)

Quantcast