• The kernel provides an abstraction layer for the applications to use the physical hardware resources • Kernel basic facilities • Process management • Memory management • Device management • System call interface
features • Portability • Compatible with the POSIX standard • Reliability (hard and detailed code review process) • Modularity (drivers and features can be loaded/unloaded at runtime) • Source code availability (GPLv2)
Good for debugging (gdb) • Lots of user-space libraries available • Unpredictable latency (context switch, scheduler, syscall, ...) • Overhead • Impossibility to fully interact with interrupt routines • Impossibility to access certain memory address • More difficult to share certain features with other drivers • Reliability: user processes can be terminated upon critical system events (OOM, filesystem errors, etc.)
Written in C and assembly • No debugging tool (kgdb, UML, ...) • Bugs can hang the entire system • User memory is swappable, kernel memory can't be swapped out • Kernel stack size is small (8K / 4K - THREAD_SIZE_ORDER) • Floating point is forbidden • Userspace libraries are not available • Linux kernel must be portable (this is important if you consider to contribute mainstream) • Closed source kernel modules taint the kernel
devices • Character devices: • Access the resource as a stream of bytes – serial port, framebuffer, input devices, video capture devices, sound devices, I2C, SPI gateways, etc. • Block devices: • Access the resource as an array of fixed-size blocks – hard disks, DVD drives, USB storage devices, SD/MMC cards, etc.
overview User space (128TB) 0x00007fffffffffff 0xffff800000000000 0xffffc7ffffffffff Physical RAM (64TB) Kernel space (2GB) 0x0000000000000000 0xffffffff80000000 0xfffffffffff00000 0 64TB Kernel space User space Virtual memory (64-bit) Physical memory
Implement a character device that allows to map a virtual address in user-space to a generic physical memory address • The mapped pages can be in kernel space, I/O mapped memory, or even a memory areas that belong to different user-space process