Subj : Re: Problem with system() calls in a multithreaded program on HPUX 11 To : comp.programming.threads,comp.sys.hp.hpux From : Paul Pluzhnikov Date : Fri Feb 11 2005 07:32 am maheshkumarjha@gmail.com (Mahesh Kumar) writes: > I am porting a multithreaded program to HPUX 11 from Solaris, in > which threads make calls to system() functions. This is extremely bad idea (TM). Writing multithreaded programs that fork() correctly requires careful use of pthread_atfork handlers for every possible lock used, both in your code and in every library you link against. > The program basically > creates a number of threads and runs them specified number of times. I don't see why you couldn't just fork() N copies of your program. Your threads don't appear to exchange any info while they run ... > Now some things that I observed are: ... These are all consistent with a race condition, where some mutex is held across the fork(). > 2. Each time the program hangs, there are one or more defunct > processes. What you want to do is attach debugger to the parent of 'defunct', and see why that parent is not wait()ing for the zombie. The parent is likely deadlocked somewhere. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. .