Path: utzoo!attcan!uunet!wuarchive!psuvax1!rutgers!njin!princeton!rise.Princeton.EDU!pfalstad From: pfalstad@rise.Princeton.EDU (Paul John Falstad) Newsgroups: comp.unix.misc Subject: Re: killing a process gone bad. Message-ID: <3613@idunno.Princeton.EDU> Date: 26 Oct 90 17:27:24 GMT References: <1990Oct25.185822.11838@nntp-server.caltech.edu> Sender: news@idunno.Princeton.EDU Organization: Princeton University, Princeton, New Jersey Lines: 37 In article <1990Oct25.185822.11838@nntp-server.caltech.edu> gwoho@nntp-server.caltech.edu (g liu) writes: >supose someone ran the following program: >main() >{ >int i; >for (i=0; i<32; i++) >signal(i,(char *)1); >while (fork()!=-1) >; >} >then ran it. how would i kill it? i could kill one of them, but >then the others multiply until the limit is reached. then one fails, >terminates, and a new one appears, etc. so i have 1000 processes >with constantly changing pids that have too be stopped simultaneously. >any ideas for stopping it? Yes. If YOU ran this, you could kill it with 'kill -9 %%', which would killpg() the whole process group. If someone else ran it, you could use a short C program that would just killpg() the process group of all 1000 processes. A smart troublemaker would setpgrp(0,getpid()) after each fork(). Line fodder. -- Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD "Your attention please. Would the owner of the Baader-Meinhof shoulder-bag which has just exploded outside the terminal please pick up the white courtesy phone."