Subject: Re: pthreads works, sorta
From: "Robert Collins" <[email-masked]>
To: "Greg Smith" <[email-masked]>, "Cygwin General MailList" <[email-masked]>
Cc: <[email-masked]>
Date: Tue, 26 Jun 2001 22:12:22 +1000

----- Original Message -----
From: "Robert Collins" <[email-masked]>

>
> ----- Original Message -----
> From: "Greg Smith" <[email-masked]>
> To: "Cygwin General MailList" <[email-masked]>
> Sent: Tuesday, June 26, 2001 12:21 PM
> Subject: Re: pthreads works, sorta
>
>
> > Robert Collins wrote:
> > > >
> > > > My (heavily threaded) application runs approximately 100x
> > > > slower than under linux and proceeds to the point where the
> > > > program thrashes because it is calling pthreads functions
> > > > faster than the pthreads implementation can deliver (we're
> > > > talking _mutex_lock/unlock and _cond_wait/signal here).
> > >
> > > Condition variables we can't do much about here, other than trying
> to
> > > get down to the metal and rewrite em without OS support. I'm not
> keen to
> > > try that, for what I hope are obvious reasons.
> >
> > True.
> >
>
> I've just reviewed my reading, and it doesn't look as though critical
> sections are going to be _much_ faster.
>
> --> Greg, do you know that your issue is thread syncronisation
> performance, or performance of I/O or other posix calls in between ?
You
> program shouldn't crash unless it manages to deadlock or trigger a
> race... certainly the pthread calls cannot happen except when your
> threads are active and have got cpu :].
>
> How many concurrent threads and mutexs and cond variables are we
talking
> here?
>

Also, if you use pthread_cond_timedwait, you might like to try the
attached patch, it fixes a misinterpretation of the time parameter in
the spec. That slight reading error would cause huge (potentially years
long!) delays. Threads would appear to hang... etc.

Changelog:
Tue Jun 26 22:10:00 2001  Robert Collins [email-masked]

    * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as
well as WAIT_ABANDONED.
    (__pthread_cond_timedwait): Calculate a relative wait from the
abstime parameter.

Rob

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/