pthread_create() slowdown with concurrent sched_yield()
Wed Mar 8 16:48:00 GMT 2017
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:
> 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
Please give them a try.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: not available
More information about the Cygwin