Mail Archives: cygwin/2007/07/06/09:42:49
------_=_NextPart_001_01C7BFD3.640C1BF7
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
> -----Original Message-----
> From: cygwin-owner AT cygwin DOT com=20
> [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Dave Korn
> Sent: Thursday, July 05, 2007 11:48 AM
> To: cygwin AT cygwin DOT com
> Subject: RE: Interference between instances on MS-Windows
>=20
> On 05 July 2007 16:33, Bob McConnell wrote:
>=20
>=20
> > If I read this right, you are saying there are no reported=20
> conflicts in
> > pthread resources between multiple processes. That is all I=20
> wanted to
> > know. I don't like to waste time diagnosing known problems=20
> and then be
> > told much later that there is an easy workaround.
> >=20
> > I wasn't asking anyone to debug either my code or Cygwin. All I was
> > asking is if there are any known threading issues in this=20
> situation. I
> > have no idea how you implemented pthreads, nor do I care.=20
> Just knowing
> > that this may be covering new ground is adequate.
>=20
> Well yeh, but there might be /unknown/ problems in the=20
> pthreads code, which
> we'd love to fix if we knew they were there.
Silly me, it looks like the sample code I found from a Google search
will do nicely as a test case.
=46rom my own tests, I found that if I eliminate the message queue and
simply sleep more than enough time to get the ACK from the host, two
instances would run in the same time as a single instance. When I use
the queue, two instances take twice as long. Sometime this morning, the
light bulb came on. I added an elapsed time calculation to the example I
copied the queue from and increased the iteration count by an order of
magnitude to make it run long enough to make a difference. A single
instance will complete in 18 seconds. Two instances take 36 seconds.
(Actually, one falls somewhere in between, but the other always takes
36.)
I have attached that code with the timers.
Compile command: gcc -o ex2 ex2b.c -Wall<Enter>
System:
CYGWIN_NT-5.0 1.5.24(0.156/4/2) 2007-01-31 10:57
Win2K SP4
P4 3.0GHz, 1 GB RAM
Any suggestions would be appreciated.
Bob McConnell
------_=_NextPart_001_01C7BFD3.640C1BF7
Content-Type: application/octet-stream;
name="ex2b.c"
Content-Transfer-Encoding: base64
Content-Description: ex2b.c
Content-Disposition: attachment;
filename="ex2b.c"
LyogVGhlIGNsYXNzaWMgcHJvZHV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kYXRhKQp7CiAgaW50IGQ7CiAgd2hpbGUg
KDEpIHsKICAgIGQgPSBnZXQoJmJ1ZmZlcik7CiAgICBpZiAoZCA9PSBPVkVS
KSBicmVhazsKICAgIHByaW50ZigiLS0tPiAlZFxuIiwgZCk7CiAgfQogIHJl
dHVybiBOVUxMOwp9CgppbnQgbWFpbih2b2lkKQp7CiAgcHRocmVhZF90IHRo
X2EsIHRoX2I7CiAgdm9pZCAqIHJldHZhbDsKICB0aW1lX3Qgc3RhcnQ7CiAg
dGltZV90IGVuZDsKCiAgaW5pdCgmYnVmZmVyKTsKICB0aW1lICgmc3RhcnQp
OwogIC8qIENyZWF0ZSB0aGUgdGhyZWFkcyAqLwogIHB0aHJlYWRfY3JlYXRl
KCZ0aF9hLCBOVUxMLCBwcm9kdWNlciwgMCk7CiAgcHRocmVhZF9jcmVhdGUo
JnRoX2IsIE5VTEwsIGNvbnN1bWVyLCAwKTsKICAvKiBXYWl0IHVudGlsIHBy
b2R1Y2VyIGFuZCBjb25zdW1lciBmaW5pc2guICovCiAgcHRocmVhZF9qb2lu
KHRoX2EsICZyZXR2YWwpOwogIHB0aHJlYWRfam9pbih0aF9iLCAmcmV0dmFs
KTsKICB0aW1lICgmZW5kKTsKCXByaW50ZiAoIkVsYXBzZWQgdGltZTogJWQu
XG4iLCAoaW50KWVuZCAtIHN0YXJ0KTsKICByZXR1cm4gMDsKfQo=
------_=_NextPart_001_01C7BFD3.640C1BF7
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------_=_NextPart_001_01C7BFD3.640C1BF7--
- Raw text -