Linux Kernel Development Best Practices

Packt_Pub
4 min readApr 27, 2018

--

The Linux kernel is a prime example of the power of open source and the merits of constructive collaboration. Initially developed in 1991 by Linus Torvalds, the kernel has been around for 27 years now, all thanks to its 14,000+ contributing developers from more than 13,000 companies all over the globe. The project’s longevity and success has been unparalleled so far, especially when you imagine the development chaos that ensues almost on a daily basis.

Upgraded frequently, the Linux kernel is probably the most dynamic kernel around, with stable versions being released every 63–70 days. Of course, such a huge project must have had its share of failures and challenges. However, all the credit for the project’s success goes to the Linux kernel community’s capacity to stay flexible and keep apace of the latest trends while adhering to several best practices. Let’s take a look at some of these best practices that have contributed to giving Linux the competitive edge.

Short Release Cycles

In the early days of kernel development, major releases would come once every few years. This, however, led to several glitches and problems in the development cycle. For instance, long release cycles meant that vast chunks of code had to be integrated at once, which proved to be rather inefficient. It also translated into a lot of pressure for the developers to integrate features in the upcoming release even if they were not completely stable or ready. Moreover, delay in releasing new features was frustrating for users and distributors alike.

That’s why, the Linux kernel development community decided to switch to short release cycles, which addressed all the issues with long release cycles. New code is immediately integrated into a stable release. Plus, continually integrating new code allows for introducing fundamental changes into the code base without causing major disruptions. Besides, there is no pressure on the developers, given the short span between two release cycles.

Distributed Development Model

Initially, all the changes made to the code base were sent to Linus Torvalds for review and integration. However, this soon proved to be cumbersome, as it is impossible for a single person to be able to keep up with something as complex and varied as an operating system kernel. The community quickly realized that a distributed model is the best way of taking the development ahead, assigning different portions of the kernel (such as networking, wireless, device drivers, etc.) to different individuals, based on their familiarity with the area. This enabled seamless code review and integration across the thousands of areas in the kernel without any compromise in kernel stability.

Consensus-Oriented Model

The Linux kernel community strictly adheres to the consensus-oriented model, which states that a proposed change cannot be integrated into the code base as long as a respected developer is opposed to it. Although this might frustrate individual developers, such a practice ensures that the integrity of the kernel is not tampered with; no single group can make changes to the code base at the expense of the other groups. Consequently, the kernel’s code base remains as flexible and scalable as always.

The No-Regressions Rule

The kernel developer community continually strives to upgrade the kernel code base, but not at the cost of quality. This is why they follow the no-regressions rule, which states that if a given kernel works in a specific setting, all the subsequent kernels must work there too. However, if the system does end up affected by regression, kernel developers waste no time in addressing the issue and getting the system back to its original state.

Zero Internal Boundaries

Developers generally work on specific parts of the kernel; however, this does not prevent them from making changes to any other part as long as the changes are justifiable. This practice ensures that problems are fixed where they originate rather than making way for multiple workarounds, which are always a bad news for kernel stability. Moreover, it also gives the developers a wider view of the kernel as a whole.

Master Linux Kernel Development

Mastering Linux Kernel Development

The Linux kernel is an ever-growing space, where updates are incorporated on an almost daily basis. This makes it imperative for kernel developers to be the best at what they do. Mastering Linux Kernel Development by Raghu Bharadwaj can help with this, as a user-friendly reference manual and the go-to guide for all kernel developers. Raghu Bharadwaj is a leading consultant, contributor, and corporate trainer on the Linux kernel with over two decades of experience. An ardent kernel enthusiast, he has been following the Linux kernel since the late 90s and brings to the book his unparalleled expertise in the area.

The book sets out to unravel the underlying details of kernel APIs and data structures, piercing through the complex kernel layers, and gives you the edge you need to take your kernel development skills to the next level. So, if you are a kernel programmer with knowledge of the kernel APIs and are eager to explore the implementation of kernel subsystems, be sure to check it out!

--

--