The Linux Boot Stack

In the Linux scheme of things the operating system is essentially a stack of programs which get initiated by the boot process. The first layer is the master boot record, which points to the boot loader program. The Master Boot Record tells the BIOS where to find the boot loader program. The instructions in the MBR are loaded and executed by the BIOS. Typically the MBR instructions load and pass control to the boot loader. The boot loader is executed to load the kernel into system memory, and start execution. The boot loader is removed once the kernel is loaded and execution is passed to it. The kernel is essentially a library of subroutines which are called as needed to deliver system services. Once the kernel is loaded and has established itself, it loads the program /sbin/init, or whichever system supervisor is installed. This program then becomes the supervisor process, which has a process ID of 1.

1) Master boot record.

2) Boot Loader Program.

3) Kernel

4) Supervisor

Once the INIT or other supervisor process is running, the inittab file is read to get the default runlevel, along with the info needed to start the terminal shell sessions. Inittab also contains the information needed to setup the various runlevels. The runlevel information is used to select /etc/rc.d/ process tree to be transversed.   On a sysvinit system the actual scripts are stored in the init.d subdirectory.  Init transverses symlinks to these programs, which are in the in the rc<run-level>.d subdirectory.  Each script which starts with an “S” is started in the order of the number following. The process is reversed as the system is shutdown such that all scripts starting “K” are “killed” in decending order according to the number following.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: