Skip to content

Kernel

November 8, 2023
March 27, 2016

Operating Systems

Think OS – Green Tea Press
cs4414: Operating Systems write a kernel in Rust

Workplace OS History: IBM’s $2 Billion Microkernel of Failure OS2

achilleasa/gopher-os: A proof of concept OS kernel written in Go
jjyr/bootgo: A barebones OS kernel written in go

Operating Systems and Middleware: Supporting Controlled Interaction stopped updating

Optimizing for Workloads: Linux Spinlocks vs. Mutexes | Nathan Petersen

What Does It Take to Make a Kernel? | Linux Journal

Is It Time to Rewrite the Operating System in Rust? - YouTube history of OS

Linux Kernel

Linux kernel - Wikiwand
The Linux Kernel documentation — The Linux Kernel documentation
The Linux Documentation Project: Guides
The Linux Kernel
The Linux Programmer's Guide
Anatomy of the Linux kernel
25 Years Later: Interview with Linus Torvalds | Linux Journal
10 moments that shaped Linux history | Opensource.com
FOSDEM 2019 - 2019 - Fifty years of Unix and Linux advances

Linux_Kernel_Newbies - Linux Kernel Newbies
Getting to Know the Linux Kernel: A Beginner's Guide - Kelsey Steele & Nischala Yelchuri, Microsoft - YouTube
A Beginner’s Guide to Linux Kernel Development (LFD103) - Linux Foundation - Training

Unix vs Linux - YouTube
Is Linux an OS, a kernel or both? (Linux vs GNU/Linux) - YouTube

Linux Rootkits for Red-Blue Teams - YouTube

Welcome to LWN.net [LWN.net]
Linux Kernel Newbies - Linux Kernel Newbies
Exploring the Linux kernel: The secrets of Kconfig/kbuild | Opensource.com
people.kernel.org Reader

What are good ways to understand the Linux kernel? - Quora
What is a Linux 'oops'? | Network World
Difference Between the macOS and Linux Kernels [Explained] | It's FOSS

Yocto Project | Open Source embedded Linux build system, package metadata and SDK generator
How to compile a Linux kernel in the 21st century | Opensource.com
DIY: Build a Custom Minimal Linux Distribution from Source | Linux Journal
Build a Custom Minimal Linux Distribution from Source, Part II | Linux Journal

Zero Copy I: User-Mode Perspective | Linux Journal

Beej's Guide to Unix IPC
How is a message queue implemented in the Linux kernel? - Unix & Linux Stack Exchange

Why we're migrating (many of) our servers from Linux to FreeBSD

Memory/Virtual Memory

What every programmer should know about memory, Part 1 [LWN.net]
Memory part 2: CPU caches [LWN.net]
Memory part 3: Virtual Memory [LWN.net]
What Is Swappiness on Linux? (and How to Change It)

What's Virtual Memory? - Computerphile - YouTube swapping
(char)0 = 0; - What Does the C++ Programmer Intend With This Code? - JF Bastien - C++ on Sea 2023 - YouTube TLB, virt2phys, page table

How does KERNEL memory allocation work? //Source Dive// 004 - YouTube
The mechanics of VIRTUAL MEMORY //Source Dive// 005 - YouTube

Books

Linux Inside · GitBook
Linux Kernel in a Nutshell 2.6.18 @2006
Linux Device Drivers, Third Edition [LWN.net] 2.6.10 @2005

System Calls

The Definitive Guide to Linux System Calls | Packagecloud Blog
syscall man page - System Calls | ManKier

Unix system calls (1/2) - YouTube
Unix system calls (2/2) - YouTube

Syscalls, Kernel vs. User Mode and Linux Kernel Source Code - bin 0x09 - YouTube
A Syscall Journey in the Windows Kernel - Alice Climent-Pommeret
Searchable Linux Syscall Table for x86 and x86_64 | PyTux

Scheduler

CFS: completely fair scheduler

OS Scheduling with Nest: Keeping Tasks Close Together on Warm Cores
nest-public / nest-artifact · GitLab
THIS NEW Linux Scheduler BOOSTS Performance of the CPU!! (UP TO 200%) - YouTube

how greedy are your processes? | Linux niceness - YouTube niceness, -20 to 19, higher nice value means lower priority

Compression

Ubuntu Moving Ahead With Compressing Their Kernel Image Using LZ4 - Phoronix
Facebook Looking To Add Zstd Support To The Linux Kernel, Btrfs - Phoronix

As used by mkinitramfs:

Device Drivers

Writing a Linux Kernel Module — Part 1: Introduction | derekmolloy.ie
Writing a Linux Kernel Module — Part 2: A Character Device | derekmolloy.ie
Writing a Linux Loadable Kernel Module (LKM) - Interfacing to GPIOs | derekmolloy.ie
Writing a Linux Loadable Kernel Module (LKM) - Interfacing to GPIOs | derekmolloy.ie
exploringBB/extras/kernel at master · derekmolloy/exploringBB

Understanding the Structure of a Linux Kernel Device Driver - Sergio Prado, Toradex - YouTube

Kernel modules

/etc/modules-load.d/
/usr/lib/modules-load.d/

systemctl status systemd-modules-load.service

DKMS

Dynamic Kernel Module Support - Wikiwand
Dynamic Kernel Module Support - ArchWiki
Kernel Korner - Exploring Dynamic Kernel Module Support (DKMS) | Linux Journal

Recompiles drivers against kernel header on host on every driver update OR kernel update.

Device Tree

Index of /doc/Documentation/devicetree/
Device tree - Wikiwand

Device Tree Tutorial (ARM) – Linux Kernel For Newbies
Device Tree Reference - eLinux.org
Device Tree for Dummies (PDF)

A Tutorial on the Device Tree (Zynq) -- Part I | xillybus.com
A Tutorial on the Device Tree (Zynq) -- Part II | xillybus.com
A Tutorial on the Device Tree (Zynq) -- Part III | xillybus.com
A Tutorial on the Device Tree (Zynq) -- Part IV | xillybus.com
A Tutorial on the Device Tree (Zynq) -- Part V | xillybus.com

USB subsystem

Ubuntu Buzz !: Reset USB 2.0 (ehci) & USB 3.0 (xhci) Without Reboot in Linux Kernel
Linux USB FAQ

Audio subsystem

Linux Audio Explained (ALSA vs PulseAudio vs JACK vs Pipewire Explained) - YouTube

sysctl

sysctl - read/write system parameters - System Calls
Sysctl Explorer

GPIO/sysfs

One way of accessing GPIO is to modify the device tree and write a device driver for it.
We could also expose the GPIO via Sysfs interface ("pinctrl" driver) (/sys/class/gpio) to allow access on user space.

GPIO - eLinux.org
Access GPIO from Linux user space
Working with GPIO on the Wandboard and Writing an Android Driver for GPIO Interrupts – Using Android in Industrial Automation with poll()
关于 /sys/class/gpio 简介 - cjsycyl 的专栏 - CSDN 博客
GPIO 接口解析-wangbaolin719-ChinaUnix 博客
Controlling GPIO from Linux User Space
RK3399 用户空间 IO 控制 - zhuyong006 的博客 - CSDN 博客

Index of /doc/Documentation/gpio/
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt Sysfs GPIO interface is deprecated
https://www.kernel.org/doc/Documentation/gpio/gpio-legacy.txt
https://www.kernel.org/doc/Documentation/ABI/obsolete/sysfs-gpio
linux/tools/gpio at master · torvalds/linux new interface

vitiral/gpio: python gpio module for linux using the sysfs file access (/sys/class/gpio). Mimics similar Raspberry Pi IO libraries

# get GPIO number in kernel
# 1. refer to spec
# 2. check debug info
cat /sys/kernel/debug/gpio

# export a GPIO pin to userspace
echo $GPIO_NUMBER > /sys/class/gpio/export

echo $GPIO_DIRECTION > /sys/class/gpio/gpio$GPIO_NUMBER/direction  # "in" or "out"
# read and write to pin
cat /sys/class/gpio/gpio$GPIO_NUMBER/value
echo 1 > /sys/class/gpio/gpio$GPIO_NUMBER/value

# clean up
echo $GPIO_NUMBER > /sys/class/gpio/unexport
# debug
mount -t debugfs debugfs /sys/kernel/debug
cat /sys/kernel/debug/gpio

I2C

Index of /doc/Documentation/i2c/
https://www.kernel.org/doc/Documentation/i2c/smbus-protocol
On Linux with proper driver installed, it is exposed as /dev/i2c-N

bjornt/pysmbus
kplindegaard/smbus2: A drop-in replacement for smbus-cffi/smbus-python in pure Python

SPI

Index of /doc/Documentation/spi/
https://www.kernel.org/doc/Documentation/spi/spi-summary

On Linux with proper driver installed, it is exposed as /dev/spidevX.Y

Video Driver

Proprietary (non-free) drivers is a source of problem. You will have to rebuild the driver every time the kernel is updated. Otherwise X will fail to start.
If performance is not an issue it is recommended to use the free drivers.

Bumblebee - ArchWiki

Hybrid graphics

Hybrid graphics - ArchWiki
Bumblebee - ArchWiki
NVIDIA Optimus - ArchWiki

Optimus Technology|NVIDIA
HybridGraphics - Community Help Wiki
How To Switch Between Intel and Nvidia Graphics Card on Ubuntu

The State of NVIDIA Optimus on Linux | The Linux Rain

wildtruc/nvidia-prime-select: This a fork of FedoraPrime enhanced for all linux distributions

File Locks

flock - apply or remove an advisory lock on an open file ("BSD Locks")
fcntl - manipulate file descriptor - System Calls | ManKier ("POSIX Locks")

lockf - apply, test or remove a POSIX lock on an open file
lsof - list open files - man page | ManKier

Checking locked files:

sudo lsof -n <file>
sudo lsof +f -- /dev/mapper/cachedev1

udev

udev - ArchWiki
Writing udev rules
Scripting with udev - jasonwryan.com

procfs

/proc Talk » Linux Magazine
Troubleshoot using the proc filesystem on Linux | Opensource.com

RPi

Department of Computer Science and Technology – Raspberry Pi: Baking Pi – Operating Systems Development
Tutorial | Building an Operating System for the Raspberry Pi
dwelch67/raspberrypi: Raspberry Pi ARM based bare metal examples

Embedded System

Mastering Embedded Linux • &> /dev/null

Unikernel

Unikernel - Wikiwand

oscarlab/graphene: Graphene / Graphene-SGX Library OS - a library OS for Linux multi-process applications, with Intel SGX support
Mini-OS-DevNotes - Xen

Unikernels [Book]

Joyent | Unikernels are unfit for production

Unikernel Linux

Unikernel Linux - Red Hat Research
Unikernel Linux - YouTube

Experimental Patches Adapt Linux For A Unikernel Design - Phoronix
Turning Linux Into A Library Operating System??? - YouTube

Unikernel

Unikernels - Rethinking Cloud Infrastructure (bought by Docker)
Projects | Unikernels Kernel as a lib

Unikernel Systems Joins Docker | Docker Blog
Docker’s Unikernel Experiment Begins Paying Off with Mac OS Libraries - The New Stack
Improving Docker with Unikernels: Introducing HyperKit, VPNKit and DataKit | Docker Blog
docker/hyperkit: A toolkit for embedding hypervisor capabilities in your application

IncludeOS

Unikernels with Idit Levine | Software Engineering Daily Mirage, Rump, UniK

MirageOS

MirageOS build unikernel for network applications, deploy minimum app, written in OCaml
Episode 204: Anil Madhavapeddy on the Mirage Cloud Operating System and the OCaml Language : Software Engineering Radio
My Other Internet is a Mirage

Boots domain 0 OS

Qubes OS

Qubes OS: A reasonably secure operating system | Qubes OS

Rump

POSIX compatible unikernel
Rump Kernels
rumpkernel/rumprun: The Rumprun unikernel and toolchain for various platforms

UniK

unikernels and unik with Scott Weiss | Software Engineering Daily

emc-advanced-dev/unik: The Unikernel Compilation and Deployment Platform Kubernetes for unikernel, supports different providers

Unikernel power comes to Java, Node.js, Go, and Python apps | InfoWorld

Light kernel

see mobile-os.md#google-fuchsia

littlekernel/lk: LK embedded kernel

Microkernel

Microkernel - Wikiwand
Is Linux kernel design outdated? : linux