Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!yale!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ncar!unmvax!bbx!yenta!dt From: dt@yenta.alb.nm.us (David B. Thomas) Newsgroups: comp.unix.questions Subject: Re: How do you handle while(1) fork(); ? Message-ID: <1655@yenta.alb.nm.us> Date: 13 Jul 90 02:20:30 GMT References: <841@massey.ac.nz> <671@mtune.ATT.COM> Organization: yenta unix pc, Rio Rancho, NM Lines: 29 jrw@mtune.ATT.COM (Jim Webb) writes: >In article <841@massey.ac.nz>, ARaman@massey.ac.nz (A.V. Raman) writes: >> Is there any way to kill all instances of a process that has the >> following piece of code in it without having to bring the system down? >> >> while (1) >> fork(); >Under System V, running "kill -9 -1" will send the kill to all processes >belonging to the invoking user. So, to stop the above, you could do that >as the user (if s/he has any processes left) or by becoming root and then >entering: > su pest -c "kill -9 -1" >if no process slots are available to the user. Obviously, this kills >everything that user is running, not just the above wonderfulness. Am I missing something? I thought the kernel table had only so many slots for processes on the whole system, each of which is available to anyone. Therefore, the nasty code would hog every last slot, preventing the administrator's shell from forking 'su'. And you can't 'exec' su, since then su would still fail to fork 'kill', and then you're logged out! Maybe unix has some saneness I haven't learned about yet to prevent this. David