Linux Kernel 101 Sriram Sundararajan
Linux : /lee'nuhks/ or /li'nuks/, not /li:'nuhks/ n. /lee'nuhks/ or /li'nuks/, not /li:'nuhks/ n. The free Unix workalike created by Linus Torvalds and friends starting about 1991 – The Jargon File Resources, compiled by ESR et al. The free Unix workalike created by Linus Torvalds and friends starting about 1991 – The Jargon File Resources, compiled by ESR et al.
Why Linux? Copious Documentation Copious Documentation Free Source Free Source Fully Customizable Fully Customizable All you need is a MB All you need is a MB Powerful Powerful
Contd…. Great technical Support Great technical Support POSIX compliant POSIX compliant And It’s a Great OS anyways And It’s a Great OS anyways
Dig This Linux and other OSS advocates are making a progressively more credible argument that OSS software is at least as robust -- if not more -- than commercial alternatives. Linux and other OSS advocates are making a progressively more credible argument that OSS software is at least as robust -- if not more -- than commercial alternatives. -- Halloween Docs.
Linus on Linux The power of Linux is as much about the community of cooperation behind it as the code itself. The power of Linux is as much about the community of cooperation behind it as the code itself.
The Process Ok I know that you all know what it is…. Ok I know that you all know what it is…. Fundamental abstraction Fundamental abstraction Process/kernel model Process/kernel model
Linux Vs.*nix Monolithic Kernel Monolithic Kernel Support for modules Support for modules Kernel Threading Kernel Threading Multithreaded application support Multithreaded application support
Contd… Nonpreemptive kernel Nonpreemptive kernel Multiprocessor Support Multiprocessor Support File System File System STREAMS I/O STREAMS I/O
On Kernels Mono and Micro… Linux Linux Solaris Solaris AIX AIX BSD BSD System V System V SCO SCO Mach Minix …. ???
The Bootstrap BIOS BIOS Boot Loader Boot Loader Floppy / Hard Disk Floppy / Hard Disk setup( ) setup( ) startup_32( ) startup_32( ) start_kernel( ) start_kernel( )
BIOS Test Hardware (POST) Test Hardware (POST) Initialize Hardware Initialize Hardware Boot from FDD/CD/HDD Boot from FDD/CD/HDD Copy sector 1 to 7c00 Copy sector 1 to 7c00
Boot Loader Floppy Floppy bootsect.S bootsect.S Move to Move to Setup real mode stack from ff4 Setup real mode stack from ff4 Display “Loading…” Display “Loading…” Load setup( ) to Load setup( ) to Load rest of kernel and jump to setup( ) Load rest of kernel and jump to setup( ) Hard disk MBR Move to 0009 a000 Setup real mode stack from 9b000 to 9a200 Display “Loading…” Load setup( ) to Load rest of kernel and jump to setup( )
setup( ) Initialize a load of Hardware devices Initialize a load of Hardware devices Adjust kernel image (low to high) Adjust kernel image (low to high) Reprograms PIC Reprograms PIC Switches CPU from real to protected mode Switches CPU from real to protected mode Jumps to startup_32( ) Jumps to startup_32( )
startup_32( ) Actually there are two of these Actually there are two of these Initializes the segment registers and stack Fills the uninitialized data area Invokes decompress_kernel( ) Jump to
Contd.. The other startup_32( ) The other startup_32( ) Init segment regs with final values Setup stack for process 0 Invokes setup_idt( ) Identifies processor model Loads GDT and IDT Jump to start_kernel( )
start_kernel( ) Finally…. Finally…. Initialize page tables Initialize page descriptors Final initialization of IDT Initialize Slab allocator Initialize system date and time Create thread for Process 1
Next… Memory Management Memory Management
References Understanding the Linux Kernel Understanding the Linux Kernel Linux Resource Exchange Operating Systems comparison nux/OS_comparison.html Linux Resource Exchange Operating Systems comparison nux/OS_comparison.html nux/OS_comparison.html nux/OS_comparison.html The Jargon File html The Jargon File html html html