From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pedro Gonnet Subject: Re: Question regarding pthread_cond_wait/pthread_cond_signal latencies Date: Sat, 21 May 2011 21:51:42 +0100 Message-ID: <1306011102.10494.34.camel@laika> References: <1305886116.10494.30.camel@laika> <4DD82514.3070407@cfl.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: linux-rt-users@vger.kernel.org To: dmarkh@cfl.rr.com Return-path: Received: from relay3.mail.ox.ac.uk ([163.1.2.165]:48953 "EHLO relay3.mail.ox.ac.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755082Ab1EUUvu (ORCPT ); Sat, 21 May 2011 16:51:50 -0400 In-Reply-To: <4DD82514.3070407@cfl.rr.com> Sender: linux-rt-users-owner@vger.kernel.org List-ID: On Sat, 2011-05-21 at 16:48 -0400, Mark Hounschell wrote: > On 05/20/2011 06:08 AM, Pedro Gonnet wrote: > > > > Hi guys, > > > > I'm currently working on a shared-memory parallel Molecular Dynamics > > simulation library (http://mdcore.sourceforge.net/) geared towards > > multi-core systems. > > > > The library uses pthreads (plus some OpenMP for some simple loops) and > > uses pthread_cond_wait and pthread_cond_signal to coordinate a group of > > worker threads. > > > > I've been profiling the library on different machines and kernels and > > have noticed that in many cases there are significant (several ms, > > measured with Intel's Vtune-thing) lags between calls to > > pthread_cond_signal and the waiting thread actually getting back to > > work. > > > > I've tried the Ubuntu -rt and -preempt kernels, and the whole simulation > > runs twice as slowly, despite following the advice given here: > > > > https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application > > > > My question is the following: which kernel (or set of configuration > > options) will minimize these latencies? And if linux-rt is the answer, > > in what ways do I have to be careful when porting the simulation for > > this kernel? > > > > Are you saying several ms latency from pthread_cond_signal to waking up a > thread in pthread_cond_wait? > Yes. Or at least, this is what Vtune says. It could also be a fluke in Vtune, but I would still be interested in knowing what kernel or what kernel options can make these operations as fast as possible. Cheers, Pedro