3 ms·
Most of the kernel code is in the drivers, the general purpose subsystems (VFS, I/O scheduler, task schedulers, memory management etc.) are a small fraction of
by stiff 8y ago
Most of the kernel code is in the drivers, the general purpose subsystems (VFS, I/O scheduler, task schedulers, memory management etc.) are a small fraction of those 25 million LOC and largely independent of each other so it is not that hard to build some understanding of them.
Some ways you can start:
- Here is start_kernel(), the kernel entry point after booting up and handling the lowest level stuff in asm:
https://github.com/torvalds/linux/blob/v4.19/init/main.c#L531 https://github.com/torvalds/linux/blob/v4.19/init/main.c#L53...
- grep for SYSCALL_DEFINE to find definitions of syscalls, e.g. this is open():
https://github.com/torvalds/linux/blob/v4.19/fs/open.c#L1076 https://github.com/torvalds/linux/blob/v4.19/fs/open.c#L1076
(understanding how the I/O and networking system calls work is quite helpful for application developers, even if you work in node.js, python or another high level language)
- this is the struct that represents each process in the system, you can pick some interesting field and search for where it is used and where updated:
https://github.com/torvalds/linux/blob/v4.19/include/linux/sched.h#L593 https://github.com/torvalds/linux/blob/v4.19/include/linux/s...
Finally, the linux-insides book is pretty helpful:
https://0xax.gitbooks.io/linux-insides/ https://0xax.gitbooks.io/linux-insides/
- blattimwind 8y ago> (understanding how the I/O and networking system calls work is quite helpful for application developers, even if you work in node.js, python or another high level language) Being able to semi-quickly figure out how the kernel actually performs some I/O operations and what the exact semantics are is tremendously useful when working with low-level I/O applications (e.g. database-like applications).