r/linux • • Nov 07 '18

Fluff Lines of code in the Linux kernel

Post image
1.2k Upvotes

169 comments sorted by

View all comments

Show parent comments

15

u/[deleted] Nov 07 '18

You do know that most of the kernel code is in the form of modules, and is loaded on-demand? Only the core code needed for initialization, memory management, disk management, process scheduling, interrupts etc. has to absolutely be in memory at all times, and that portion doesn't take up much memory (although the data structures used might take up a bit more, it's nothing compared to userspace memory usage).

2

u/zebediah49 Nov 09 '18

Don't forget all the code that's for handling various architectures (looks like about 2M lines), and which will actually be entirely compiled out for every arch other than the one you need.