linux kernel 101 sriram sundararajan. linux : /lee'nuhks/ or /li'nuks/, not...

19
Linux Kernel 101 Sriram Sundararajan Sriram Sundararajan

Upload: jody-tyler

Post on 16-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 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

Linux Kernel 101

Sriram SundararajanSriram Sundararajan

Page 2: 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

Linux :

/lee'nuhks/ or /li'nuks/, /lee'nuhks/ or /li'nuks/, notnot /li:'nuhks/ n. /li:'nuhks/ n. The free Unix workalike created by Linus The free Unix workalike created by Linus

Torvalds and friends starting about 1991 – Torvalds and friends starting about 1991 – The Jargon File Resources , compiled by The Jargon File Resources , compiled by ESR et al.ESR et al.

Page 3: 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

Why Linux?

Copious DocumentationCopious Documentation Free SourceFree Source Fully CustomizableFully Customizable All you need is a 386 + 4MBAll you need is a 386 + 4MB PowerfulPowerful

Page 4: 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

Contd….

Great technical SupportGreat technical Support POSIX compliantPOSIX compliant And It’s a Great OS anywaysAnd It’s a Great OS anyways

Page 5: 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

Dig This

Linux and other OSS advocates are Linux and other OSS advocates are making a progressively more credible making a progressively more credible argument that OSS software is at least argument that OSS software is at least as robust -- if not more -- than as robust -- if not more -- than commercial alternatives. commercial alternatives.

-- Halloween Docs.-- Halloween Docs.

Page 6: 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

Linus on Linux

The power of Linux is as much about The power of Linux is as much about

the community of cooperation the community of cooperation behind it as the code itself. behind it as the code itself.

Page 7: 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

The Process

Ok I know that you all know what it is…. Ok I know that you all know what it is…. Fundamental abstractionFundamental abstraction Process/kernel modelProcess/kernel model

Page 8: 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

Linux Vs.*nix

Monolithic KernelMonolithic Kernel Support for modulesSupport for modules Kernel ThreadingKernel Threading Multithreaded application supportMultithreaded application support

Page 9: 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

Contd…

Nonpreemptive kernelNonpreemptive kernel Multiprocessor SupportMultiprocessor Support File SystemFile System STREAMS STREAMS I/OI/O

Page 10: 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

On Kernels Mono and Micro…

LinuxLinux SolarisSolaris AIXAIX BSDBSD System VSystem V SCOSCO

MachMach MinixMinix ……. ???. ???

Page 11: 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

The Bootstrap

BIOSBIOS Boot LoaderBoot Loader Floppy / Hard DiskFloppy / Hard Disk setup( )setup( ) startup_32( )startup_32( ) start_kernel( )start_kernel( )

Page 12: 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

BIOS

Test Hardware (POST)Test Hardware (POST) Initialize HardwareInitialize Hardware Boot from Boot from FDD/CD/HDDFDD/CD/HDD Copy sector 1 to 7c00Copy sector 1 to 7c00

Page 13: 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

Boot Loader

FloppyFloppy bootsect.Sbootsect.S Move to 0009 0000Move to 0009 0000 Setup real mode stack Setup real mode stack

from 0000 3ff4from 0000 3ff4 Display “Loading…”Display “Loading…” Load Load setup( ) to 90200setup( ) to 90200 Load rest of kernel Load rest of kernel

and jump to and jump to setup( )setup( )

Hard diskHard disk MBRMBR Move to 0009 a000Move to 0009 a000 Setup real mode stack Setup real mode stack

from 9b000 to 9a200from 9b000 to 9a200 Display “Loading…”Display “Loading…” Load Load setup( ) to 90200setup( ) to 90200 Load rest of kernel Load rest of kernel

and jump to and jump to setup( )setup( )

Page 14: 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

setup( )

Initialize a load of Hardware devicesInitialize a load of Hardware devices Adjust kernel image (low to high)Adjust kernel image (low to high) Reprograms PICReprograms PIC Switches CPU from real to protected modeSwitches CPU from real to protected mode Jumps to startup_32( )Jumps to startup_32( )

Page 15: 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

startup_32( )

Actually there are two of theseActually there are two of these Initializes the segment registers and stackInitializes the segment registers and stack Fills the uninitialized data areaFills the uninitialized data area Invokes Invokes decompress_kernel( )decompress_kernel( ) Jump to 0010 0000Jump to 0010 0000

Page 16: 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

Contd..

The other The other startup_32( )startup_32( ) Init segment regs with final valuesInit segment regs with final values Setup stack for process 0Setup stack for process 0 Invokes Invokes setup_idt( )setup_idt( ) Identifies processor modelIdentifies processor model Loads GDT and IDTLoads GDT and IDT Jump to Jump to start_kernel( )start_kernel( )

Page 17: 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

start_kernel( )

Finally….Finally…. Initialize page tablesInitialize page tables Initialize page descriptorsInitialize page descriptors Final initialization of IDTFinal initialization of IDT Initialize Slab allocatorInitialize Slab allocator Initialize system date and timeInitialize system date and time Create thread for Process 1Create thread for Process 1

Page 18: 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

Next…

Memory ManagementMemory Management

Page 19: 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

References

Understanding the Linux KernelUnderstanding the Linux Kernel Linux Resource Exchange Operating Linux Resource Exchange Operating

Systems comparison Systems comparison http://www.falconweb.com/~linuxrx/WS_Lhttp://www.falconweb.com/~linuxrx/WS_Linux/OS_comparison.htmlinux/OS_comparison.html

The Jargon File The Jargon File http://www.tuxedo.org/~esr/jargon/quoting.http://www.tuxedo.org/~esr/jargon/quoting.htmlhtml