Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: mjg@ktbush.ogo.dec.com (Michael J. Grier)
Subject: Re: Thread-safe libraries for C++?
Date: Tue, 16 Feb 1993 23:14:12 GMT	[thread overview]
Message-ID: <1993Feb16.231412.21635@nntpd.lkg.dec.com> (raw)
In-Reply-To: 1993Feb16.175330.11699@mdivax1.uucp


In article <1993Feb16.175330.11699@mdivax1.uucp>, robinson@mdivax1.uucp (Jim Robinson) writes:
|>Michael J. Grier (mjg@ktbush.ogo.dec.com) wrote:
|>>   It means that there is liberal use of #define to change your invocation
|>>of standard library functions to instead call the DCE jacket, which is
|>>a function which will perform the work behind your back to ensure that the
|>>operation is carried out in a thread-safe manner.
|>
|>[and]
|>
|>>   For some operations, the jackets go farther to give you some semblance of
|>>thread-synchronous operation, for example select().  Your mileage will
|>>vary depending on your UNIX variant and how serious its kernel is about not
|>>blocking when non-blocking I/O is requested.
|>
|>Is it correct to say then that if one forgets to #include the relevant
|>header the result is that the native select() is used which could block
|>the entire process instead of just the calling thread? Is so, isn't this
|>an incredibly easy mistake to make which may not be terribly easy to
|>catch?

   You can work around it in a given project by having one of your central
h files #include the relevant definitions.  That's how we handle it, and
it usually works out OK.

   Depending on your environment, it may be very easy to catch -- you'll
hang!  ;-)  In a situation where a blocking I/O doesn't block for long,
you'll just get degraded performance.

   Since followups were redirected to comp.unix.osf.misc, I assume we're
talking in the context of OSF/1, so with kernel support for threads, things
may be different.  There are different models of how pthreads threads map
onto OSF/1 kernel threads, so it depends upon the mapping chosen.  If threads
always map one-to-one to kernel threads, I believe that you will not have a
problem.  If the mapping is not one-to-one, you can/will get one of the kernel
threads hung in a select() or other blocking I/O call.

|>
|>And, are the jacket routines also used to map blocking I/O calls (e.g.
|>read(), recvfrom()) to non-blocking versions?
|>

   Yes.  It's true of any call which blocks the running thread while in
the kernel.

|>[Followup to comp.unix.osf.misc only]
|>-- 
|>Jim Robinson
|>robinson@mdd.comm.mot.com
|>{ubc-cs!van-bc,uunet}!mdivax1!robinson
|>
|>
------------------------------------------------------------------------
I'm saying this, not Digital.  Don't hold them responsibile for it!

Michael J. Grier                           Digital Equipment Corporation
(508) 496-8417                             mjg@ktbush.ogo.dec.com
Stow, Mass, USA                            Mailstop OGO1-1/E16



  reply	other threads:[~1993-02-16 23:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-02-12 18:43 Thread-safe libraries for C++? Mike Doel
1993-02-12 12:22 ` Jon C. R. Bennett
1993-02-13 18:17   ` Pete Becker
1993-02-14 22:26     ` Andrew Walduck
1993-02-12 20:40 ` Michael J. Grier
1993-02-16 17:54   ` Jim Robinson
1993-02-16 23:14     ` Michael J. Grier [this message]
1993-02-18  2:51     ` Michael Joosten
1993-02-18 22:05     ` Greg Brail
1993-02-16 22:29 ` Bob Martin
1993-02-17 18:15   ` John Nagle
1993-02-18 14:37     ` Andrew Condon
1993-02-22 20:22       ` Greg Brail
1993-02-16 22:30 ` Greg Brail
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox