FreeBSD Kernel Internals Course Description

What is FreeBSD?

FreeBSD, like Linux, is an open-source UNIX-like operating system that is widely used to support the core infrastructure of many companies worldwide. Because it can be built with a small footprint, it is also seeing increased use in embedded applications. The licensing terms of FreeBSD do not require the distribution of changes and enhancements to the system. The licensing terms of Linux require that all changes and enhancements to the kernel be made available in source form at minimal cost. Thus, companies that need to control the distribution of their intellectual property increasing are building their products using FreeBSD.

Who Should Take this Course

This course is of direct use to the professionals who work with FreeBSD systems. Applications developers can learn how to effectively and efficiently interface to the system; systems programmers can learn how to extend, enhance, and interface to the system; system administrators without direct experience with the FreeBSD kernel can learn how to maintain, tune, and configure the system; and individuals involved in technical and sales support can learn the capabilities and limitations of the system.

This course provides a broad overview of how the FreeBSD kernel implements its basic services. It will be most useful to those who need to learn how these services are provided. Students who will benefit from this course include operating-system implementors, system programmers, UNIX application developers, administrators, and curious users. This course is directed to users who have had at least a year of experience using a UNIX-like system. Knowledge of the C programming language is helpful, but not essential. They should have an understanding of fundamental algorithms (searching, sorting, and hashing) and data structures (lists, queues, and arrays).

Description

This 40-hour course provides a firm background in the FreeBSD kernel. The course starts with an introduction to the kernel and the services that it provides including the locking used for concurrency control. Next, the details of processes are described including process management tasks such as scheduling and signals. The security framework and policies are outlined including Capsicum sandboxing and the FreeBSD jail facility that allows the creation of isolated virtual hosts running on the same system. The description of processes concludes with an extensive description of the management of kernel and process memory. The course then turns to an I/O view of the kernel by introducing the I/O framework and detailing the infrastructure for doing I/O multiplexing and supporting both local and remote filesystems. It then describes how it configures and operates both character devices and bulk data transfer devices such as disks and how it manages virtual devices needed support Xen and bhyve virtualization. The design and implementation of three filesystems is covered: the Fast filesystem (FFS), the Zettabyte filesystem (ZFS), and the Network filesystem (NFS). Next the interprocess communication (IPC/socket) interface is detailed followed by coverage of the layering and implementation of the networking including routing, forwarding, and security of the TCP/IP protocols. Following coverage of the kernel startup procedure, the course concludes by pulling the presented concepts together to show how they can be used to do performance measurement and system tuning. The presentations emphasize code organization, data structure navigation, and algorithms rather than reviewing the kernel code itself. It does not cover the machine specific parts of the system such as the implementation of device drivers.

Course Materials

Each student receives a copy of the textbook by Marshall Kirk McKusick, George V. Neville-Neil, and Robert N.M. Watson: The Design and Implementation of the FreeBSD Operating System, Second Edition, published by the Addison-Wesley subsidiary of Pearson Education. Each student also receives a CD-ROM with a copy of the course notes containing copies of all the overhead slides used in the course and a set of papers that provide supplemental reading to the text book. The CD-ROM also contains an extensive set of written notes about each lecture and a set of weekly readings and exercises along with answers to the exercises. For an extra $50.00 fee, the overhead slides are available in a 440-page spiral-bound book.

Course Organization

Preface) An introduction to the FreeBSD community
Lecture 1) Introduction: kernel terminology and basic kernel services
Lecture 2) Kernel-resource management: locking
Lecture 3) Processes: process structure and process management
Lecture 4) Security: security framework and policies, Capsicum, and jails
Lecture 5) Virtual memory: virtual-memory management, paging, and swapping
Lecture 6) Kernel I/O system: multiplexing I/O, support for multiple filesystems, the block I/O system (buffer cache), and stackable filesystems
Lecture 7) Devices: special files, pseudo-terminal handling, autoconfiguration strategy, structure of a disk device driver, and machine virtualization
Lecture 8) Local filesystem implementation: fast filesystem (FFS)
Lecture 9) Local filesystem implementation: zettabyte filesystem (ZFS)
Lecture 10) Remote filesystem implementation: network filesystem (NFS)
Lecture 11) Interprocess communication: concepts and terminology, basic IPC services, system layers and interfaces, and code review of a simple application that demonstrates use of the IPC and network facilities
Lecture 12) Network layer: IPv4 and IPv6 protocols, firewalls, and routing
Lecture 13) Transport layer: TCP and SCTP
Lecture 14) System startup: boot loaders, kernel startup, and system launch; system measurement tools.
Lecture 15) System tuning: performance measurement and system tuning

Further Information

Buying the class on video.

Click here or on the above to watch the first hour of the first lecture of the course taught in 2006.