pthreads, fork & exec vs. system(), solaris, others (fwd)
Kevin D. Clark
kevin_d_clark at access-4-free.com
Mon Jan 17 23:23:01 EST 2005
"Steven W. Orr" <steveo at syslang.net> writes:
> A friend wrote me with a problem. The basic gist is that it works
> under Solaris but fails under AIX. Description below. Any takers?
Generally speaking, the Solaris environment is very friendly. The AIX
environment isn't very friendly.
I'm not even making a pejorative statement here -- sometimes incorrect
code runs "just fine" on Solaris. On AIX the same code will probably
blow up. Myself, I like to know when such problems exist, so
unfriendly platforms like AIX are useful in some respects.
> Large thread stack size (8 mb) may help.
Increasing your stack size to 8mb is almost certainly masking some
real problem somewhere.
> and what compile / load options are appropriate for Forte compiler?
Your mail mentions -D_REENTRANT for the Forte compiler but you really
need "-mt" instead.
> Purify on Solaris
> found no problems in 2 runs.
Purify claims to detect stack overflows but in practice this feature
rarely works for me.
> AIX: -lpthread -qthreaded
How are you invoking the compiler? "xlC_r .... -lpthread -qthreaded"
> Ideas: convert fork() & execle() to
> system()
> on AIX
>
> Devote 1 thread to fork & exec
>
> Find purify-like compile + run options for AIX.
If it were me, I would seriously consider porting this program over to
g++ (possibly on Solaris). Then, I would compile the program with
full warnings turned on (-w, -pedantic), etc. and I would fix all of
the problems. Then I would compile the program with -fstack-check
(note: in a multi-threaded program some code changes might be needed
here). I would also turn on all warnings with the Solaris and AIX
compilers and fix these problems too.
--kevin
--
GnuPG ID: B280F24E And the madness of the crowd
alumni.unh.edu!kdc Is an epileptic fit
-- Tom Waits
More information about the gnhlug-discuss
mailing list