Web lists-archives.com

Re: pthread_create() slowdown with concurrent sched_yield()




On Mar  7 16:19, Dan Bonachea wrote:
> I suspect I may have discovered a corner-case performance bug in
> Cygwin's pthread_create() implementation. The problem arises when a
> call to pthread_create() is made concurrently with multiple pthreads
> in the same process spinning on calls to sched_yield(). I've searched
> the Cygwin mailing list archives, user guide, FAQ, and Google and not
> found any mention of this particular misbehavior.
> 
> A minimal demo program is copied below and also available here:
>    https://upc-bugs.lbl.gov/bugzilla/attachment.cgi?id=549
> The demo program is a narrowed-down version of test code used in the
> GASNet communication system (http://gasnet.lbl.gov).
> 
> The test code calls pthread_create to spawn a user-controlled number
> of threads, which then execute 1000 "spin barriers" - implemented by
> spinning on in-memory flags and stalling with sched_yield(). The test
> can also optionally insert a pthread_barrier_wait() across all threads
> before the first spin barrier.

Thanks for the thorough analysis and especially the testcase!

I applied a fix for this problem and uploaded new developer snapshots
to https://cygwin.com/snapshots/

Please give them a try.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature