Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: wright@clam.hi.com (David Wright)
Subject: Re: Threads and shared memory
Date: 17 Sep 1993 13:44:00 -0000	[thread overview]
Message-ID: <27ct10INNg8u@clam.hi.com> (raw)
In-Reply-To: CDI44s.968@atria.com

In article <CDI44s.968@atria.com> mishkin@atria.com (Nathaniel Mishkin) writes:
|Bruno.Richoux (brunor@cnmat5.frec.bull.fr) wrote:
|: I would like to have the following information about using threads in the 
|: following context : one multi-threaded UNIX process and several "normal"
|: UNIX processes communicate data through a shared memory segment. This 
|: segment is accessed exclusively and is then protected by an IPC semaphore.
|: The questions are :
|
|: 1) Are the UNIX system calls semop and semctl blocking : if the
|: semaphore is locked, a call to semop by a thread blocks the thread or
|: blocks the process ?  
|
|: 2) Related to 1), are there jacket routines developped for primitives
|: handling shared memory and / or semaphores and where can I get the
|: information (I've got the DCE thread sources).
|
|If you're talking about the straight DCE Threads implementation and
|unless things changed a lot since last I looked at this stuff (9
|months ago), the semaphore ops will block all the threads (i.e., the
|whole process).  Short of polling, I don't think there's a way to
|write jacket routines for the semaphore ops.  The problem is that UNIX
|feature adders seemed to miss the point of having one "N-way wait"
|primitive that can be used to wait on all things that could block
|particular system calls.  So we have select() which works on file
|descriptors but not semaphores, poll() which can be used to wait on
|Streams-based things but not other things, and semaphores which are in
|a class of their own.  For process death, you can more or less stumble
|by with SIGCHLD, but it's less than satisfactory.  ptrace() events?
|Sorry.
|
|Presumably a real kernel-based threads implementation would get this
|sort of thing right.  Windows NT did _and_ they made a single N-way
|wait primitive (WaitForMultipleObjects()) as well.

I'm using DCE threads in the kernel-threads-based version on our OSF/1
implementation (IBM-compatible mainframe, and I think I must be the
first person ever to try DCE/CMA kernel threads, based on the bugs I've
found).  It does work the way a DCE user would want; only the thread
issuing a system call is blocked till that call returns. 

  -- David Wright, Hitachi Computer Products (America), Inc.  Waltham, MA
     wright@hicomb.hi.com  ::  These are my opinions, not necessarily 
     Hitachi's, though they are the opinions of all Right-Thinking People


  reply	other threads:[~1993-09-17 13:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-16  9:36 Threads and shared memory Bruno.Richoux        
1993-09-17 13:58 ` Nathaniel Mishkin
1993-09-17 13:44   ` David Wright [this message]
1993-09-17 16:05   ` Andrew Hastings
1993-09-17 16:21   ` Douglas C. Schmidt
1993-09-17 20:02     ` Nathaniel Mishkin
1993-09-18 18:21       ` Douglas C. Schmidt
1993-09-19 23:12         ` Dave Weisman
1993-09-22 20:07           ` Brian Sturgill
1993-09-23  1:20             ` Douglas C. Schmidt
1993-09-23 13:09               ` Nathaniel Mishkin
1993-09-27 13:54               ` George J. Carrette
1993-09-17 14:48 ` Dave McCracken
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