How do you handle while(1) fork(); ?
Anthony Shipman
als at bohra.cpg.oz
Tue Jul 17 19:37:35 AEST 1990
In article <4261 at uqcspe.cs.uq.oz.au>, rhys at batserver.cs.uq.oz.au (Rhys Weatherley) writes:
> I would also be interested in a summary, but how about this one:
>
> while (!fork ())
> {
> /* some non-important code */
> }
> /* some "clean-up" code */
> exit (0);
>
> This will create a round-robin of processes, where each process spawns
> a child, and then dies (fork() returns 0 in the child process). Extremely
> difficult to kill these ones, because by the time you have a process-id
> to kill, that process doesn't exist usually anymore! This is an
I had this problem once. I used a little program that did a kill -9 on a pid
that was ahead of the pid sequence from the runaway program. The kill -9 was
put into an infinite loop. There was a good chance that the kill would get the
process when its pid got big enough. (There was also some chance that an
innocent process would be killed, but not much).
--
Anthony Shipman ACSnet: als at bohra.cpg.oz.au
Computer Power Group
9th Flr, 616 St. Kilda Rd.,
St. Kilda, Melbourne, Australia
D
More information about the Comp.unix.questions
mailing list