* semop() and threads -- a bad mix ?
@ 1993-06-18 18:28 Jeffrey L. DeMent
1993-06-18 23:07 ` John Stafford
1993-06-21 18:48 ` Greg Brail
0 siblings, 2 replies; 3+ messages in thread
From: Jeffrey L. DeMent @ 1993-06-18 18:28 UTC (permalink / raw)
To: DCE Community
I have a serious DCE issue and any insights or help would be appreciated.
FYI: we have the Transarc DCE implementation running on Sun hardware.
Our company has developed a collection of reusable UNIX-based software
assets (a few years ago before DCE), and if an application wishes to use
the complete suite of software components, it must architect it's program
a certain way. I am not a (deep) system internals person so bear with me.
Most of the software assets assume you are using their "event loop mechanism"
which uses semop() to create an environment for the program where there is only
one blocking -- namely this semop() command (exactly like an X event loop -- in
fact, if you use X and this software, it assumes the responsibilities of the X
event loop). The program continuely loops, waiting for any pre-defined event,
(such as a SIGALRM signal from a timer function -- one of the assets they
wrote). When the event is received, a chuck of code is executed to deal with
the event and the program goes back to waiting (at the semop system call).
In our environment this seems to effectively prohibit the use of threads
because even if you create a thread to deal with the event and immediately
go back to the loop, the semop() call blocks the process and consequently
the thread you just created. In other words, as I understand it, this
program architecture as implemented using semop() makes parallelism impossible
and hence defeats a fundamental advantage of DCE.
AND IF all this is in fact true, does it not mean you cannot mix X-windows
and threads in the same binary ?
From these facts, does anyone have any insights, solutions or validation of
my assessment of the situation ? I would be glad to provide additional details,
this is very important to our company. Thanks.
Jeff
_____________________________________________________________________
Jeffrey L. DeMent _._._._._._._
U S WEST Advanced Technologies (_|_|_|_|_|_|_)
1475 Lawrence Street, Suite 400 ` \` | | '/ '
Denver, Colorado 80202 ` \`| |'/ '
` \| |/ '
Phone: (303) 595-0519 ` \0/ '
FAX: (303) 592-6532 `~#~'
^
Internet: jld@advtech.uswest.com
_____________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: semop() and threads -- a bad mix ?
1993-06-18 18:28 semop() and threads -- a bad mix ? Jeffrey L. DeMent
@ 1993-06-18 23:07 ` John Stafford
1993-06-21 18:48 ` Greg Brail
1 sibling, 0 replies; 3+ messages in thread
From: John Stafford @ 1993-06-18 23:07 UTC (permalink / raw)
Jeffrey L. DeMent (jld@advtech.uswest.com) wrote:
| AND IF all this is in fact true, does it not mean you cannot mix X-windows
| and threads in the same binary ?
To the best of my knowledge, (at least) the event handling functions of
X-windows are not reentrant. So even if semop threads vs X can be made
to "work" (and it doesn't sound good although I am ignorant in that
area), you would still have to mix X and threads with care.
John "been there, done that - using X from Ada tasks" Stafford
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: semop() and threads -- a bad mix ?
1993-06-18 18:28 semop() and threads -- a bad mix ? Jeffrey L. DeMent
1993-06-18 23:07 ` John Stafford
@ 1993-06-21 18:48 ` Greg Brail
1 sibling, 0 replies; 3+ messages in thread
From: Greg Brail @ 1993-06-21 18:48 UTC (permalink / raw)
In article <C8ty07.AM5@da_vinci.it.uswc.uswest.com> Jeffrey L. DeMent <jld@advtech.uswest.com> writes:
>Most of the software assets assume you are using their "event loop mechanism"
>which uses semop() to create an environment for the program where there is only
>one blocking -- namely this semop() command (exactly like an X event loop -- in
>fact, if you use X and this software, it assumes the responsibilities of the X
>event loop).
I looked around a little, and the documentation for the DCEs that I
can find -- namely the "Programmer's Notes on HP DCE Threads," doesn't
mention semop() at all. It's not in the list of thread-safe functions
or the list of non-thread-safe functions, so I assume it's not
thread-safe and will indeed block your whole program when you call it.
Is there any way you can re-implement this thing using honest-to-God
DCE locking methods like mutex locks and condition variables? (I've
never used semop myself, so I don't know.)
>AND IF all this is in fact true, does it not mean you cannot mix X-windows
>and threads in the same binary ?
No. Implementations of DCE come with thread-safe versions of most
standard library functions, so library code that doesn't do anything
weird (like call semop) shouldn't block your whole program. However,
you usually must restrict calls to such library functions to a single
thread. You can certainly use DCE and X together, but you must ensure
that you make all your X calls from one and only one thread.
If you need more info on DCE and X, we've made it work here and my
boss said he'd mail me the instructions.
greg
--
Greg Brail ------------------ Citibank -------------------- gjb@fig.citib.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-06-21 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-06-18 18:28 semop() and threads -- a bad mix ? Jeffrey L. DeMent
1993-06-18 23:07 ` John Stafford
1993-06-21 18:48 ` Greg Brail
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox