last proc table slot

dbj.rice at rand-relay dbj.rice at rand-relay
Wed Aug 3 19:13:06 AEST 1983


From:  Dave Johnson <dbj.rice at rand-relay>

        If all the proc table slots (except one for root) are gone and
        you log in as root it will probably be a bit hard to do a 'ps' as
        you just took the one reserved for root when you logged in.

You've probably gotten about 3000 replies already that say this, but here
goes:  When you log on, you don't take up any more proc table slots since
there is always a process for each terminal already running waiting for
somebody to walk up and type a user name on the terminal.  If the terminal
is a dialup, this process is hung on the open of the terminal line in init,
while if the terminal is hardwired and there is always a carier on the line,
the process has execed getty, and the process is hung reading the user name
from the terminal.  In either case, once you get logged on, this process
then execs the shell, so no new process is needed.  You still have that
spare proc table slot for your "ps" command and then for a "kill" command to
kill the offender.

Right as you log off, though, the "login" process for that terminal finally
exits, and init must fork a new one to take its place.  If you ran out of
proc table slots just as this was happening, init's fork for this new
process would take up the last proc table slot (the one reserved for root)
since init runs as root.  Even in this case, though, you'd be able to log on
since there was a proc table slot left for this process.  Then, after
getting on, you could exec the "ps" command from your login shell with the
"exec" command built in to both the Bourne shell and C-shell.  This would,
in effect, log you off, but that's no problem -- init would just fire up a
new process for that terminal taking the newly vacated process slot (it can
take the last slot again since it's running as root), and you just log on
again and exec another command the same way.  Eventually, you could get in
enough commands to find out who is taking up all the proc table slots and do
a "kill" command on him.

                                        Dave Johnson
                                        Dept. of Math Science
                                        Rice University
                                        dbj.rice at Rand-Relay



More information about the Comp.unix.wizards mailing list