Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #524

Re: Comparison of various synchronization mechanisms?

From Alexander Terekhov <terekhov@web.de>
Newsgroups comp.programming.threads
Subject Re: Comparison of various synchronization mechanisms?
Date 2011-08-24 12:49 +0200
Organization A noiseless patient Spider
Message-ID <4E54D73A.285BA80B@web.de> (permalink)
References <0ddf3aed-90df-4cf0-ac3f-7ca6a07ae638@w11g2000vbp.googlegroups.com> <4E4BCB80.6ECB7053@web.de> <4ecbf8fd-1c82-4a9a-a1a0-334df616e5d5@d7g2000vbv.googlegroups.com>

Show all headers | View raw


Papa Stratos wrote:
> 
> >
> > What is your real problem regarding (all/one) waiting thread(s), Papa?
> 
> Right now, none really :) I am just trying to educate myself, knowing
> which synchronization mechanisms to use when it happens to have
> multiple threads waiting on the same lock.

Just use a proper type of lock. E.g. it really does make sense for
pthread_rwlock_unlock() to unlock multiple blocked readers vs only one
blocked writer depending on rwlock's policy (or lack thereof).

> 
> For instance (http://pubs.opengroup.org/onlinepubs/009604499/functions/
> pthread_cond_signal.html), pthread_cond_broadcast() is explicit about
> waking all threads. pthread_cond_signal() states "at least one" which
> may or may not create performance problems.
> 
> On the Windows side (http://msdn.microsoft.com/en-us/library/
> ms682396%28v=vs.85%29.aspx), signalling an event would wake a single
> thread.
> 
> Just curious if I can find a discussion on the subject anywhere.

There is plenty of discussion to be found on the net (including archives
of this newsgroup) on the topic of pros and cons regarding various types
of synchronization objects. Just do a (re)search.

regards,
alexander.

Back to comp.programming.threads | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Comparison of various synchronization mechanisms? Papa Stratos <armadillodm@flashmail.com> - 2011-08-16 18:20 -0700
  Re: Comparison of various synchronization mechanisms? Alexander Terekhov <terekhov@web.de> - 2011-08-17 16:09 +0200
    Re: Comparison of various synchronization mechanisms? Papa Stratos <armadillodm@flashmail.com> - 2011-08-20 17:06 -0700
      Re: Comparison of various synchronization mechanisms? Alexander Terekhov <terekhov@web.de> - 2011-08-24 12:49 +0200

csiph-web