Introduction

User vs Kernel

Typical operating system architecture

../_images/ditaa-12614a4afe93c9e1ae68861a79f14afe4f3e4b3e.png

Monolithic kernel

../_images/ditaa-b80a9008bc3c846632969af516b640297e62e680.png

Micro-kernel

../_images/ditaa-5802a7c7d56e7a90c0802cd243a3564024db8d8b.png

Monolithic kernels can be modular

“Hybrid” kernels

Many operating systems and kernel experts have dismissed the label as meaningless, and just marketing. Linus Torvalds said of this issue:

“As to the whole ‘hybrid kernel’ thing - it’s just marketing. It’s ‘oh, those microkernels had good PR, how can we try to get good PR for our working kernel? Oh, I know, let’s use a cool name and try to imply that it has all the PR advantages that that other system has’.”

Address space

User and kernel sharing the virtual address space

../_images/ditaa-00760697e2d08607719269ad7b81254e597c09f8.png

Execution contexts

Multi-tasking

Preemptive kernel

Preemptive multitasking and preemptive kernels are different terms.

A kernel is preemptive if a process can be preempted while running in kernel mode.

However, note that non-preemptive kernels may support preemptive multitasking.

Pageable kernel memory

A kernel supports pageable kernel memory if parts of kernel memory (code, data, stack or dynamically allocated memory) can be swapped to disk.

Kernel stack

Each process has a kernel stack that is used to maintain the function call chain and local variables state while it is executing in kernel mode, as a result of a system call.

The kernel stack is small (4KB - 12 KB) so the kernel developer has to avoid allocating large structures on stack or recursive calls that are not properly bounded.

Portability

Asymmetric MultiProcessing (ASMP)

../_images/ditaa-b705b1e00a45dab8a2425a4bd02e9b79b03c06e8.png

Symmetric MultiProcessing (SMP)

../_images/ditaa-c7d1db15e70a728ef4e12fde5800d792bb0e60fc.png

CPU Scalability

Linux development model

Maintainer hierarchy

Linux source code layout

../_images/ditaa-c5a3d9943ec8b9c9f94c6d49caae3811d23063b0.png

Linux kernel architecture

../_images/ditaa-da2fa642419267d1ad7e6528d8976defc2000106.png

arch

Device drivers

Process management

Memory management

Block I/O management

../_images/ditaa-1a27eaf8fb0e144906f0babd7b502d4f17e20d58.png

Virtual Filesystem Switch

../_images/ditaa-7687ac05df2abc741196ff07a1ee9c80f397fdfa.png

Networking stack

../_images/ditaa-5f7331b406ff05ea5e1ade333ee346650d05ab50.png

Linux Security Modules