1st Edition

The Art of Linux Kernel Design Illustrating the Operating System Design Principle and Implementation

By Lixiang Yang Copyright 2014
    534 Pages 309 B/W Illustrations
    by Auerbach Publications

    534 Pages
    by Auerbach Publications

    534 Pages 309 B/W Illustrations
    by Auerbach Publications

    Uses the Running Operation as the Main Thread

    Difficulty in understanding an operating system (OS) lies not in the technical aspects, but in the complex relationships inside the operating systems. The Art of Linux Kernel Design: Illustrating the Operating System Design Principle and Implementation addresses this complexity. Written from the perspective of the designer of an operating system, this book tackles important issues and practical problems on how to understand an operating system completely and systematically. It removes the mystery, revealing operating system design guidelines, explaining the BIOS code directly related to the operating system, and simplifying the relationships and guiding ideology behind it all.

    Based on the Source Code of a Real Multi-Process Operating System

    Using the 0.11 edition source code as a representation of the Linux basic design, the book illustrates the real states of an operating system in actual operations. It provides a complete, systematic analysis of the operating system source code, as well as a direct and complete understanding of the real operating system run-time structure. The author includes run-time memory structure diagrams, and an accompanying essay to help readers grasp the dynamics behind Linux and similar software systems.

    • Identifies through diagrams the location of the key operating system data structures that lie in the memory
    • Indicates through diagrams the current operating status information which helps users understand the interrupt state, and left time slice of processes
    • Examines the relationship between process and memory, memory and file, file and process, and the kernel
    • Explores the essential association, preparation, and transition, which is the vital part of operating system

    Develop a System of Your Own

    This text offers an in-depth study on mastering the operating system, and provides an important prerequisite for designing a whole new operating system.

    From Power-Up to the Main Function

    Loading BIOS, Constructing Interrupt Vector Table, and Activating

    Interrupt Service Routines in the Real Mode

    Loading the OS Kernel and Preparing for the Protected Mode

    Transfer to 32-bit Mode and Prepare for the Main Function

    Summary

    Device Initialization and Process 0 Activation

    Set Root Device 2 and Hard Disk

    Set Up Physical Memory Layout, Buffer Memory, Ramdisk, and Main Memory

    Ramdisk Setup and Initialization

    Initialization of the Memory Management Structure mem_map

    Hooking the Interrupt Service Program

    Initialize the Request Structure of the Block Device

    Binding with the Interrupt Service Routine of Peripherals and Establishing the Human–Computer Interaction Interface

    Time Setting

    Initialize Process 0

    Initialize the Buffer Management Structure

    Initialize the Hard Disk

    Initialize the Floppy Disk

    Enable the Interrupt

    Process 0 Moves from Privilege Level 0 to 3 and Becomes a Real Process

    Creation and Execution of Process 1

    Creation of Process 1

    Kernel Schedules a Process for the First Time

    Turn to Process 1 to Execute

    Creation and Execution of Process 2

    Open the Terminal Device File and Copy the File Handle

    Fork Process 2 and Switch to Process 2 to Execute

    The System Gets to the Idle State

    File Operation

    Install the File System

    Opening a File

    Reading a File

    Creating a New File

    Writing a File

    Modifying a File

    Closing a File

    Deleting a File

    The User Process and Memory Management

    Linear Address Protection

    Paging

    When to Apply the Process to a New Page and When You Should Not

    Map the New Application Page to the Linear Address in the Process

    Complete Process of User Process from Creation to Exit

    Multiple User Processes Run Concurrently

    Buffer and Multiprocess Operating File

    Function of Buffer

    Structure of Buffer

    The Function of b_dev, b_blocknr, and Request

    Function of Uptodate and Dirt

    Function of the Count, Lock, Wait, Request

    Example 1: Process Waiting Queue of Buffer Block

    Overall Look at the Buffer Block and the Request Item

    Example 2: Comprehensive Examples of Multiprocess Operating File

    Inter-Process Communication

    Pipe Mechanism

    Signal Mechanism

    Summary

    Operating System’s Design Guidelines

    Run a Simple Program to See What the Operating System Has Done

    Thoughts on the Design of the Operating System: Master-Slave

    Mechanism

    Three Key Techniques in Realizing the Master

    Decisive Factor in Establishing the Master-Slave Mechanism: The Initiative

    Relationship Between Software and Hardware: Host and Process, Peripherals and File

    Parent and Child Processes Sharing Page

    Operating System’s Global Interrupt and the Process’s Local Interrupt: Signal

    Summary

    Conclusion

    Biography

    Lixiang Yang is an associate professor of the University of Chinese Academy of Sciences. His research interests include operating systems, compilers, and programming language. Recently, he and his team successfully developed a new operating system that aims to fundamentally solve the problem concerning the intrusion of illegal programs into computers. They set up two websites for hackers to perform the intrusion attack test. These addresses are ftp://203.198.128.163/and ftp://114.242.35.6/.