TimeLinux1

Tuesday, April 19, 2011

Linux: A closer look - 1

-The first version of linux was 0.01 in 1991 (by Linus Torvalds).
-It had 9300 lines of C and 950 lines of assembly language code.
-'Linux' is usually meant to refer to the linux kernel.
-the linux kernel is responsible for managing the h/w and providing a system call interface to all programs.
-the system calls form the standard call library that live in user mode.
-the standard library (fork, open, read, write)is different from the standard utilities (like shell, X, gcc etc)
-the 'make' utility helps maintain large programs whose source code consists of multiple files.
-multiple source files can share header files using the 'include' keyword.
-so if a header file changes the source files need recompilation.
-the purpose of make utility is to keep track of which source file depends on which header.

-linux kernel components:
-kernel sits on the h/w and supports the overlying programs via system calls.
-the kernel can be broadly divided into 3 layers - lowest, middle and top.

-at the lowest layer of the kernel are interrupt handlers and dispatchers.
-interrupts are the primary way of interacting with devices. interrupts cause dispatching.
-when an interrupt happens, the dispatcher stops a running program, saves its state and starts the next program.
-interrupt code is in C while dispatcher code is in assembly language.

-at the middle layer of the kernel exist IO manager, memory manager and process manager.
-IO manager deals with device drivers for filesystems, network devices and terminals.
-memory manager deals with physical to virtual memory mapping, cache maintenance etc.
-process manager deals with process creation, scheduling and termination.

-at the top layer of the kernel exists the system call interface.
-user events lead to system calls causing a trap event that lead to action on the lower and middle layers as seen above.
-as one can imagine, the three layers of the linux kernel are highly interdependent in existence and action.

... continued ...

No comments:

Post a Comment