* Re: Looking for info on threads usage
[not found] ` <CAzs3I.LFo@fig.citib.com>
@ 1993-08-02 16:06 ` David Wright
1993-08-03 16:10 ` Erik_Brown
1993-08-03 16:43 ` Greg Brail
0 siblings, 2 replies; 3+ messages in thread
From: David Wright @ 1993-08-02 16:06 UTC (permalink / raw)
In article <CAzs3I.LFo@fig.citib.com> gjb@fig.citib.com (Greg Brail) writes:
>In article <23912uINNnu9@duca.hi.com> wright@duca.hi.com (David Wright) writes:
>>
>>I'm seeking informed opinion about the usage of DCE threads and other
>>pthreads implementations. Specifically, I've ported DCE threads to
>>our OSF/1, using kernel threads. This seems to work fine (after I
>>removed quite a few nasty bugs), but it does have the limitation that
>>we don't support priority setting or policy setting.
>
>Not all DCE implementations support thread priorities, or even policy
>setting (assuming by that you mean policies for mutex locks and
>condition variables). I regard the thread priority stuff as
>non-portable.
Well, if I read the spec correctly, the priority and policy stuff is
not required of a pthreads implementation. However, if you decide to
implement one of those features, there's a set of capabilities you
need to include.
Anyway, this answers one of my questions -- for the nonce, not
allowing priority or policy setting doesn't appear to be much of a
limitation.
>>Also, we can't
>>support applications that want to have a helper thread in the
>>background to intercept asynchronously-generated signals (e.g. quit).
>Does this mean you don't support sigwait()? The other DCE
>implementations I've use require the use of sigwait instead of other
>signal-handling interfaces. I usually do this by spawning a thread
>that calls sigwait and waits for a signal (hence the name :-) ). How
>does your threading system support signals? It's awfully useful to be
>able to catch them. I can see restricting usage of signals like SIGVTALRM
>and SIGIO like some DCE implementations do, but reliable DCE programs
>should be able to catch signals like SIGINT and SIGTERM to handle
>reliable shutdown.
We support sigwait(), but only for the original thread in a process.
That's because all asynchronously-generated signals are fed to that
thread. Any child threads can only receive synchronously-generated
signals (e.g. SIGILL, SIGFPE). This is how our Mach implementation
(OSF/1) does it. I have ground my teeth about this more than once,
but for now we're stuck with it.
This is the reason we can't do signal_to_cancel_np; that call wants to
spawn off a child thread to act as a signal interceptor, which in our
setup it is incapable of doing.
So, in conclusion, do you (or anyone else -- don't be shy, speak right
up!) think this is a serious limitation? I'd hate to go to user
threads now if I don't have to.
-- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Looking for info on threads usage
1993-08-02 16:06 ` Looking for info on threads usage David Wright
@ 1993-08-03 16:10 ` Erik_Brown
1993-08-03 16:43 ` Greg Brail
1 sibling, 0 replies; 3+ messages in thread
From: Erik_Brown @ 1993-08-03 16:10 UTC (permalink / raw)
wright@duca.hi.com (David Wright) writes:
>
> [stuff deleted]
>
> We support sigwait(), but only for the original thread in a process.
> That's because all asynchronously-generated signals are fed to that
> thread. Any child threads can only receive synchronously-generated
> signals (e.g. SIGILL, SIGFPE). This is how our Mach implementation
> (OSF/1) does it. I have ground my teeth about this more than once,
> but for now we're stuck with it.
>
> This is the reason we can't do signal_to_cancel_np; that call wants to
> spawn off a child thread to act as a signal interceptor, which in our
> setup it is incapable of doing.
>
> So, in conclusion, do you (or anyone else -- don't be shy, speak right
> up!) think this is a serious limitation? I'd hate to go to user
> threads now if I don't have to.
I think the benefits from using OS threads are substantial, so I would
stay away from user threads if possible. However, I don't completely
understand why you can't implement a generic sigwait().
Could you implement sigwait() to record the desired signals and wait on
a condition variable? The main thread then has a handler for all
signals. When a signal comes into the main thread, you look to see if
any other thread is expecting this signal. If so, then you wake up that
thread's condition variable. If not, then you provide the default
signal behavior.
Perhaps I'm missing something, but would this work? I would expect
programs to call sigwait() on signals like SIGINT (Ctrl-C), and I doubt
users will assume that they must restrict these calls to the initial
thread. In fact, it's probably more likely that they'll spawn a waiter
thread from which they call sigwait().
Erik Brown
Transarc
ps. the above comments are my own and in no way reflects the opinion or
position of Transarc Corp.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Looking for info on threads usage
1993-08-02 16:06 ` Looking for info on threads usage David Wright
1993-08-03 16:10 ` Erik_Brown
@ 1993-08-03 16:43 ` Greg Brail
1 sibling, 0 replies; 3+ messages in thread
From: Greg Brail @ 1993-08-03 16:43 UTC (permalink / raw)
In article <23js4sINNsjt@duca.hi.com> wright@duca.hi.com (David Wright) writes:
>Anyway, this answers one of my questions -- for the nonce, not
>allowing priority or policy setting doesn't appear to be much of a
>limitation.
Do you mean "for the novice?" If that's the case, you're right --
it's not a serious limitation. But it's still a limitation, and
I've written code where I'd like to be able to use thread priorities,
only I can't because it's non-portable.
>We support sigwait(), but only for the original thread in a process.
>That's because all asynchronously-generated signals are fed to that
>thread. Any child threads can only receive synchronously-generated
>signals (e.g. SIGILL, SIGFPE). This is how our Mach implementation
>(OSF/1) does it. I have ground my teeth about this more than once,
>but for now we're stuck with it.
I think that's a much more serious limitation. Can one use signal(),
sigvec(), and the like and still have the program come out
thread-safe? That's better, but it's still different from other DCE
threads implementations. Having to call sigwait() in the main thread
is pretty ugly.
greg
--
Greg Brail ------------------ Citibank -------------------- gjb@fig.citib.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-08-03 16:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <23912uINNnu9@duca.hi.com>
[not found] ` <CAzs3I.LFo@fig.citib.com>
1993-08-02 16:06 ` Looking for info on threads usage David Wright
1993-08-03 16:10 ` Erik_Brown
1993-08-03 16:43 ` Greg Brail
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox