Linux Internals

Summary
This Linux Internals course focuses on the elements of the Linux Kernel that allow the programmer to build software components which are heavily linked to the hardware level in computer systems. The Linux operating system benefits from a modular Kernel structure that allows programmers to focus on a particular area without interfering with the other parts of the Kernel. Given that the programmer knows how to use the various interfaces and tools already built into the Kernel, adding a new feature to the OS is therefore greatly simplified. This course allows the student to gain a good general understanding of these basic tools and interfaces in order to successfully modify features and develop new aspects of the Linux Kernel. Since this course is based on the latest versions of the Linux Kernel (version 2.4.x), students will be able to contribute to the current Linux development efforts. The course includes many questions to facilitate an interactive learning experience. There are five major labs that give students a strong practical experience of the steps involved in Kernel development by focusing on real world exercises.

Prerequisites
Students are expected to have a good working knowledge of the C programming language. For example, UNIX signals, processes and filesystem access methods will be used in this course but will not be extensively explained. An intermediate knowledge of the UNIX/Linux shell commands is needed. Students should also know how to use one of the commonly used UNIX editors (Vi, Emacs or others). Experience with the basic data structures (arrays, linked lists, etc.) is also necessary. Some sections of the course involve the assembly programming language, but the instructor will assume no prior knowledge of the assembly language.

Course Objectives
On completion of this course, the student should be able to
  • Install and configure the Linux Kernel.
  • Understand the structure under which the Linux Kernel was built and continues to evolve.
  • Gain an understanding of the tasks that we use the Kernel for.
  • Modify, test and implement new features in the Linux Kernel.
  • Identify the difference between user space and Kernel space on the Linux operating system, and understand how we can link these two levels.
  • Be able to use the various hardware abstraction levels that the Kernel makes available to the programmer, in order to produce code which is both architecture and version independent.
  • Distinguish the differences between the version 2.4 and 2.2 of the Linux Kernel.

Length
5 Days

Format
Instructor-led course, with practical computer-based exercises.

Course Outline
  • Introduction to Linux Internals
    • Introduction and Environmental Setup
    • Main Characteristics of the Linux Operating System
    • Linux Distributions
    • Kernel Configuration facilities
    • Building the Kernel
    • Location of components
    • Compiling2
  • Kernel Overview
    • Important Data structures
      • Processes and tasks
      • Files and Inodes
      • Dynamic memory management
      • Queues and semaphores
      • System time and timers
    • Primary algorithms
      • Signals
      • Interrupts
      • System booting
      • Timer interrupt
      • Scheduler
    • System call implementation
      • Description of system calls
      • Practical examples
      • Adding new system calls
  • Memory Management
    • Architecture-dependent memory model
      • Pages
      • Virtual address space
      • Linear address conversion
      • Page table and page directory
      • Middle page directory
    • Virtual address space model
      • User segment
      • Virtual memory
      • The brk system call
      • Mapping functions
      • Kernel segment
      • Static and dynamic memory allocation in the Kernel
    • Block device caching
      • Block buffering
      • Update and bdflush
      • List structures for the buffer cache
      • How to use the buffer cache
    • Paging in Linux
      • Page cache management
      • Finding free pages
      • Page exceptions
  • Inter-Process Communication
    • Synchronization
    • Communication via files
    • Pipes
    • Debugging using “ptrace”
    • SysV Inter-Process communication
    • Socket based communications
  • File System
    • Basic aspects
    • VFS
    • Mouting a file system
    • Superblock
    • The Inode concept and operations
    • File operations
    • Directory cache
    • Proc filesystem
    • Ext2 filesystem
      • Structure
      • Directories
      • Block allocation
      • Extensions
  • System Calls
    • Initialization
    • Process management
    • Memory management
    • Communication
    • Filesystem
  • Kernel-Related Commands
    • Ps
    • top
    • free
    • init
    • shutdown
    • strace
    • traceroute
    • mount
  • Device Drivers
    • Character vs Block devices
    • Polling and interrupts
      • Polling and interrupt mode
      • Interrupt sharing
      • Bottom halves
      • Task queues
    • Implementation
      • Setup
      • Init
      • Open and release
      • Read and write
      • IOCTL
      • Select
      • Lseek
      • Mmap
      • Readdir
      • Fsync and fasync
      • Check_media_change and revalidate
  • Module management
    • Interfaces to modules
    • Adding/removing modules to the Kernel
      • Insmod
      • Modprobe
      • rmmod
    • Implementation details
  • Network
    • Layer model
    • Network communications
    • Data structures
      • Socket
      • sk_buff
      • Inet socket
      • proto
    • Devices
      • Ethernet
      • SLIP and PPP
      • Loopback
      • Dummy device
    • Protocols
      • Arp
      • IP
      • Functions
      • Routing
      • Multicasting
      • Packet filters
      • Accounting
      • Firewalls
    • UDP
      • Standard and extra functions
    • TCP
      • Standard functions
      • Communication details
  • SCSI Subsystem
    • Architecture overview
    • Names and conventions
    • Upper level
    • Block devices (hard disks, CD-ROM)
    • Character devices (Tape)
    • Generic drivers
    • Mid level (Boot parameters, proc interface)
    • Lower (Hardware) level and Pseudo drivers
  • Boot process
    • Booting details
      • LILO
        • Started by MBR
        • Started by a boot manager
        • Structure in the MBR
        • Files
        • Parameters
        • Start-up messages
        • Error messages
  • Hands-on
    • Day 1: Basic Kernel configuration, building and testing.
    • Day 2: Filesystem internals
    • Day 3: Implementing a new system call and integrating it in the Kernel
    • Day 4: Device driver development: design and implementation
    • Day 5: Making modules out of device driver
    Hardware and Software Requirements
    This course requires each student to have access to a computer, typically a 233 MHz Pentium containing 64 MB or RAM, or better.

    These workstations should be able to run on RedHat Linux 7.0. Prior to the training session, the training center should make sure that RedHat works perfectly on the workstations in order to avoid wasted time on first day of training.

    The computers used by the students should be hooked together on a local Ethernet network (10BaseT or better). Again, the training center should make sure that the network cards are compatible with Linux. Internet access from the workstations could be helpful but is not essential. An Internet access should be made available for the instructor.

    Finally, the students usually benefit greatly from presentations done with a LCD projector. This course involves a large amount of code being presented to students, so this aspect makes a LCD projector almost a necessity.

    Go to course catalogue