Andrew Gable

ProjectsResumeBlog

Killing Pid Number One

09 September, 2014 - 1 min read

In my Operating Systems class at Boise State we were given a experiment to run a loop that kills all the processes starting at Pid number one. So I wrote the program:

/*******************
 * kill.c 
 * Andrew Gable
 * Sept 9, 2014
 * ****************/

#include <sys/types.h>
#include <signal.h>

int main()
{
    int i = 1;
    for(i; i < 2000000; i++)
    {
        kill(i, SIGKILL);
    }

}

The result was a brief black screen, then my login screen appeared. This will happen regardless of whether the program was run as normal user or super user.

Killing PID number one seems to kill the virtual and force a restart.

© 2020 Andrew Gable