[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about kill(1)



Adeodato Simó wrote:
> * Bob Proulx [Thu, 07 Jul 2005 21:24:07 -0600]:
> > > * why the different implementations?
> 
> > It is there for BSD job control functionality.  That way you can say
> > 'kill %1' and kill the background jobs by job control number.  The
> > standalone version does not know about the shell's list of jobs.
> 
>   I also have heard (but I'm not sure how often does this happen, if at
>   all) that it is usefult to have it as a built-in when your system is
>   in a state when it can't create more processes.

The v7 shell did not have a built-in kill.  But having it built-in as
with later shells is certainly useful at times for the purpose you
state.  But the problem is finding the number of the process to kill.

With /proc available to get process id numbers with 'echo /proc/*'
which does not spawn a new process this is easier than in the old days
from pstat*(2) and a standalone 'ps' process.  Because without /proc
and needing to run 'ps' to get a listing of processes if you had a
full process table you could not run ps and could not find the process
id to kill easily.  Too many times I have seen "cannot fork" messages
from the shell.  But if you knew a process id that you could kill to
gain a few more process slots then even in the v7 shell you had a way
to kill it.

The technique showed to me from an experienced unix hacker when I was
learning this was 'exec kill -9 ##'.  By using the running shell for
the process you get one attempt for the command so better make it
effective. :-)

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: