Is Linux Growing Out of All Proportion?
The kernel source code isn't as big as you might think
October 13, 2021
As of October 1st, the Linux kernel source¹ is comprised of over 22 million lines of code (excludes comments, blank lines)². In the past 15 years that figure has increased an average of over 10% per year. At this rate, it will reach 50 million lines of code by 2030. If you studied 2,000 lines of kernel source code per day, you’d never catch up. So is the kernel growing out of all proportion?
It turns out that driver code makes up over 65% of the source code:
And large chunks of the driver code, like
amdgpu are auto-generated anyway. The non-driver code has grown at around %5 per year.
The idea that the Linux kernel source might be bloated is really a question of software quality; a notoriously nebulous concept. One of the more robust ways to gauge software quality is to compare two different software projects. The trouble is, there are no easy apples-to-apples comparisons we can make. Microkernels like seL4, HelenOS and Mach do not have the same goals, capabilities or levels of hardware support. Common proprietary alternatives like MacOS or Windows are closed source.
The Windows XP SP1 source is almost 44 million lines of code but in addition to being 20 years old it also includes a GUI, many apps (e.g. text editor, media player, internet browser) and a Java virtual machine!
If you’re interested in studying the Linux kernel source code, the online book “The Linux Kernel"³ has a dated but gentle intro.
- GitHub.com Linux Kernel Source Tree
- Counted using cloc
- Rusling; The Linux Kernel
Tags: linux cloc windows