HELP !! Forking processes ??!!??

HELP !! Forking processes ??!!??

Post by J?rgen Hauklan » Tue, 27 Jan 1998 04:00:00

Hi !

I'm developing an app in ACL (an OO extension to Tcl) and I'm stuck in the
following problem:

I have an object A (a GUI) with a pusbutton that creates an object B with a
method (member function in C++) that among other things updates a counter X
in a dataslot in B. I want object A to read the counter X in object B and
display it as it is being updated. As it goes for now, A creates B which
executes the method that upgrades X, the method finishes and I'm only able
to read X in its final state.

I (think I) need a way to stop the method in B and read X in the dataslot at
a number of times and display it in A.

Somebody mentioned something about forking processes in UNIX -- is that the
smartest way to handle this ? I'd hope I could solve this internally in
ACL/Tcl. Any hints, help and especially code samples will be greatly

-jorgen haukland
Telenor R&D


1. Why <defunct> process after leaving a fork()ed process?

Hallo everybody!

I have a problem concerning forking processes. I have a main
program where the user may select some pushbuttons to start
another application. Everything works fine, except that after
leaving one of the 'model' applications, ps still shows the
process number, but as <defunct>. I'm running SUN OS 4.1.3. How do
I get rid of the process? After some starting and leaving
of 'child' applications the list of <defunct> processes might
get quite long.

What am I missing?
                Thanx in advance

and leaving one again

 7950 p3 IW    0:00 Parent
 7951 p3 IW    0:00 model model
 7952 p3 IW    0:00 model model
 7953 p3 Z     0:00 <defunct>

Source code
        if ((pid = fork()) < 0)
           return -1;

        if (pid > 0)
           /* The parent */
           fprintf(stderr, "PID = %d\n", pid);
        if (pid == 0)
           /* The child */
           execlp("model", "model", "model", NULL);

  Christian Steinebach
  Division of Marine Operation
  POST  : MARINTEK, P.O.Box 4125 Valentinlyst, N-7002 TRONDHEIM, Norway
  TEL   : +47 7359 5916
  FAX   : +47 7359 5778

2. Where to find libshadow.a for Samba

3. passing stdin to a forked process, after writing some data to the process ..

4. Computone ATvantage 8-port not found

5. forked child process remains in process table

6. IP-adress?

7. comsat forking, forking and forking (3.2.0)

8. How can I un-compress the "tar.gz" file!

9. Help: "Can not fork process" error

10. HELP: fork failed - too many processes

11. Need alittle help on using "Fork" multiple process?

12. Forked processes not terminating (HELP!)

13. Help: LOGIN: could not fork user's shell process: Resource temporarily unavailable (error 11)