This course delves deep into the implementation details of the Linux kernel.
This course is targeted at system administrators and performance specialists who want a better understanding of kernel operation, system and application programmers who need background knowledge on Linux kernel design, and individuals who intend to write device drivers or kernel modules.
This course is available for the Red Hat distribution, but differences between Red Hat and other distributions are covered as they occur (such as for SUSE or Debian/Ubuntu Linux).
Overview of the Linux Kernel
Linux Kernel Flow (interrupts, synchronization, preemption)
Process Management
The Linux System Call Subsystem
Virtual Memory Management
Disk-based Filesystems
Kernel File System Structures
Linux Signals
Linux Socket Layer
Device I/O
Process Scheduling (optional)
Upon completion of this course, the student will be able to describe the various functions of the Linux kernel and discuss in detail the concepts which govern its operation. In addition, the hands-on exercises will reinforce the issues involved in kernel code development.
Students are invited to bring their current ideas and questions to the classroom for discussion. Case studies, lecture, group problem solving, and online laboratories will be used. Students will be encouraged to enhance their skills utilizing the techniques presented through classroom problem solving and controlled online workshops.
The only prerequisite is that students should be familiar with the Unix/Linux command line interface. The students will be expected to execute commands, edit files, and navigate around system directories. Many of the labs require shell command lines.
Students with the following experience will find the more detailed descriptions helpful, but these are not prerequisites since the course covers any required knowledge needed to understand the topics.
Experience in C programming
Understanding of basic shell scripting for Unix/Linux
Welcome to the Linux Kernel
THE LINUX OPERATING SYSTEM
IS LINUX UNIX?
THE ORIGINS OF LINUX
LINUX TODAY
LINUX PLATFORMS
LINUX ISSUES
USEFUL LINUX WEB SITES
OPERATING SYSTEMS
THE UNIX OPERATING SYSTEM
THE LINUX OPERATING SYSTEM
ARRAYS AND LINKED LISTS
LINUX SUBSYSTEMS
KERNEL EXTENSIONS
STUDYING THE KERNEL
LINUX KERNEL VERSION NUMBERS
THE LINUX KERNEL SOURCE CODE
LINUX HEADER FILES
LINUX CODE STYLE
"THIS IS YOUR KERNEL SPEAKING" -- THE printk()
FUNCTION
PROGRAMS AND PROCESSES
MULTITASKING
SINGLE THREADED PROCESSES
MULTITHREADED PROCESSES
THREAD CONCEPTS
HOW LINUX REALIZES THREADS
COFF AND ELF
THE PROCESS IMAGE
CONTROLLING RESOURCE CONCUMPTION
Linux Kernel Flow
LINUX NOTIFIERS
AN INTRODUCTION TO HARDWARE INTERRUPTS
REGISTERING AN INTERRUPT HANDLER
HARDWARE INTERRUPT EVENT FLOW
UNDERSTANDING PROCESSOR ENVIRONMENTS
KERNEL SYNCHRONIZATION
KERNEL PREEMPTION
Linux Process Management
CLASSES OF PROCESSES
PROCESSES, THREADS, AND TASKS -- THE KERNEL'S VIEW
THE task_struct
STRUCTURE
THE KERNEL'S TASK LIST
TRACKING THREADS
USERS, PROCESSES AND TASKS
PROCESS CREDENTIALS
THE user_struct
STRUCTURE
THE signal_struct
STRUCTURE
RESOURCE LIMITS
THE FAMILY TREE
PARENT PROCESSES
ADDITIONAL TASK MANAGEMENT STRUCTURES
PROCESS ID NUMBERS
THE LIFE CYCLE OF A TASK
THE PER-TASK KERNEL STACK
THE thread_info
STRUCTURE
ACCESSING THE CURRENT TASK'S task_struct
STRUCTURE
CLOCK TICKS, JIFFIES AND TIME SLICES
DOES ANYBODY REALLY KNOW WHAT TIME IT IS?
THE fork()
SYSTEM CALL
CREATING THREADS
THE REAL TRUTH ABOUT fork()
THE exec
SYSTEM CALL FAMILY
THE exit()
SYSTEM CALL
THE wait
SYSTEM CALL FAMILY
THE waitid()
SYSTEM CALL
THE SHELL AS AN EXAMPLE
THOSE PESKY ZOMBIES
The Linux Kernel API Subsystem
WHAT IS A SYSTEM CALL?
A MODE SWITCH
RETURNING FROM A SYSTEM CALL
SYSTEM CALL WRAPPERS
MODE SWITCH MECHANISMS
SYSTEM CALL NUMBERS
THE syscall_table[]
PUTTING IT ALL TOGETHER
THE VDSO
ADDING A NEW SYSTEM CALL TO THE LINUX KERNEL
Linux Memory Management
LINUX MEMORY MANAGEMENT OVERVIEW
MEMORY MANAGEMENT BASICS
32-BIT PROCESSOR VIRTUAL ADDRESS SPACE
PHYSICAL MEMORY AND THE KERNEL
UMA AND NUMA
PHYSICAL MEMORY ZONES
kmalloc()
AND FRIENDS -- HOW THE KERNEL ALLOCATES MEMORY
RECLAIMING PAGES
NODE AND ZONE MANAGEMENT STRUCTURES
THE zone
STRUCTURE
THE page
STRUCTURE
REVIEW OF THE PROCESS IMAGE
SHARED LIBRARIES
HEAP MANAGEMENT
THREADS AND STACKS
64-BIT PROCESSES
VIEWING THE MEMORY REGIONS OF A PROCESS
VMM DATA STRUCTURES
VIRTUAL MEMORY AREAS (VMAS)
ADDRESS TRANSLATION -- 32 BIT
LINUX PAGE TABLES
ADDRESS TRANSLATION FOR PHYSICAL ADDRESS EXTENSIONS (PAE)
ADDRESS TRANSLATION -- 64 BIT
PAGE FAULT HANDLING
Inside Disk-Based File Systems
UNIX FILE TYPES
REGULAR FILES
LINUX DISK-BASED FILE SYSTEMS
DISK INODES
DIRECTORIES
THE LOGICAL FILE SYSTEM
THE PHYSICAL FILE SYSTEM
BASIC FILE SYSTEM STRUCTURE
THE SUPER BLOCK
JOURNALING FILE SYSTEMS
THE DESIGN OF THE ext4
FILE SYSTEM
BLOCK GROUP DESCRIPTORS
MODERN DIRECTORY STRUCTURE
ext4
RESERVED INODES
BLOCK-BASED VS. EXTENT-BASED FILE SYSTEMS
Kernel File System Structures
FILE I/O OVERVIEW
FILE DESCRIPTORS
THE FILE LIST
STDIN, STDOUT AND STDERR
THE DIRECTORY CACHE
THE MOUNT LIST
IN-CORE INODES
FILE AND INODE OPERATIONS -- THE LINUX VIRTUAL FILE
SYSTEM
PER-TASK FILE SYSTEM INFORMATION
FILE AND RECORD LOCKS
BASIC FILE I/O SYSTEM CALLS
EXPLICIT FILE MAPPING
Linux Signal Management
THE LINUX SIGNAL LIST
THE kill()
SYSTEM CALL
SIGNAL DELIVERY
THE signal()
SYSTEM CALL
THE sigaction()
SYSTEM CALL
SIGNAL HANDLING AND THREADS
INTERNALS OF SIGNAL DELIVERY
Linux Sockets
WHAT ARE SOCKETS?
THE TCP/IP PROTOCOL STACK
SOCKET APPLICATIONS
SOCKET SYSTEM CALLS
SOCKET INTERNALS
Linux Device I/O
COMPONENTS OF DEVICE I/O
ANATOMY OF A LINUX DEVICE DRIVER
DEVICE REGISTRATION TABLES
THE DEVICE DRIVER JUMP TABLE
CREATING A DEVICE SPECIAL FILE -- THE mknod
COMMAND
ONE MORE WORD ABOUT DEVICE NUMBERS
OPENING A DEVICE FILE
READING FROM A DEVICE
WRITING TO A DEVICE
LINUX KERNEL MODULES
WRITING AND COMPILING A LINUX MODULE
SETTING UP THE JUMP TABLE
REGISTERING A DEVICE DRIVER
A SAMPLE MODULE
Linux Process Scheduling
BASIC SCHEDULING CONCEPTS AND GOALS
SCHEDULING TERMINOLOGY
UNDERSTANDING REAL-TIME
POSIX SCHEDULING POLICIES
REAL-TIME SCHEDULING POLICIES
THE SCHEDULING API
THE HISTORY OF LINUX SCHEDUELRS
THE COMPLETELY FAIR SCHEDULER
RUN QUEUES AND R/B/TREES
TRUE TIME VS. VIRTUAL TIME
TASK SCHEDULER FIELDS
CPU AFFINITY (PROCESSOR BONDAGE)
SCHEDULER CLASSES
THE NICE VALUE
PROCESS PRIORITIES
REAL-TIME PRIORITIES
CALCULATING PRIORITIES
RUN QUEUES
SCHEDULING ENTITIES
CALCULATING LOAD WEIGHT
THE SCHEDULERS