X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=R9PHA3d67h3YIKsgA/XLF3kijZbspBD+yOXDzYwkEHuJrFquNmBU7 c2Xo5uqZ1k6JH4PYmng8phd10+WcLYqU7ef3cMIe+2uVUjzkBcARBn7PfXL5ggxE 3BBFVtweTel+fq8XZMjKLdGUOSakRWtWVfAcm6Sl8JgCpkr/vn1j5A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=57n4Pcozygte+Ju5RoZF3MIRkgc=; b=a+KedTOFelEtUTjFvC311Qz9Bw4U onfyrg+6ithhmiMow+1+hJrJoIBvmZKxJ7n80CEh4Y69rDZykaFNMLiAz7kOhQGy nXDU+42nCzJtRYhWDNC1isaNBPmk6uDYFwoQiKXx8kteLt7YYPSjrMCcZcZWRgfI iufgX6Kccx7F0Mw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-101.7 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*MI:sk:CAJTO8-, H*i:sk:CAJTO8-, H*f:sk:CAJTO8-, Hx-languages-length:1395 X-HELO: drew.franken.de Date: Wed, 8 Mar 2017 17:48:53 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: pthread_create() slowdown with concurrent sched_yield() Message-ID: <20170308164853.GA1559@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > A minimal demo program is copied below and also available here: > https://upc-bugs.lbl.gov/bugzilla/attachment.cgi?id=3D549 > The demo program is a narrowed-down version of test code used in the > GASNet communication system (http://gasnet.lbl.gov). >=20 > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYwDX1AAoJEPU2Bp2uRE+gUS0P/iVXAbwVp6rstlhHpF6oKLuz AvNL15dh3osQ2vY214DMEPlCfhAMc25tfverJXSVqh3oT0P5KEDcPSxlANzlq66v /TpqR/h7w+rqZULemtxEseG4XzuSgB+VRgAjSvXM23r8WaKcfkuro4HbnoE549gQ TgPwFViv8KwruToNk07nnbmXEeDG8oidL8814U1ghjdcWcwQrBIR5agmAXkBuB6e j27zlM16/LQ4uU7w2UssKi3SsusqHwr7BJKOfP1yZQMXbGDwkce9V/g4dQce2XPi 9LB/AWePEIWM/aomRmw8dUW+EFcoCocNz8PaAZtDmtqA1lVIIm0UcMPOYU/4VN/K JEqojEQf7+AsmSlxiSJcgb9QnRJnZ4y3b91svdq3PBsNDOfPhaKjJ86hbNqy53ur 7XwqDXcGZptSkZhHWcbOGcjaYmi3TAE+DYzlINe50chZfhXspaVfF7hLaKMv2yaB xsReumpJ9uO/5mDwl2VIIW/XiAunEkEUy+GCT6lHnVGEmICNdgxuExRo87XqFmkg DyGYriVPvATGWoX+gpMZV7B+WJ+TmaQHW8KMnNhjvUtAXoWGCusW+8koeY/evu+t bnYIpJYAxN/HMLuz8QIMVlt2JvQIM5a8LbfCNDj8Ka9bJRBOvGEZTevyFd4wZMJv Kar9gVHIzGZPauCchVup =JaPP -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE--