KRN-230 · Linux Kernel Core

Kernel Locking Primitives

Every locking primitive the kernel offers, when each is correct, and the deadlocks that follow from choosing wrong.

Practitioner 3 days in person6 half-days online Max 14 in person

Who this course is for

Kernel and driver developers writing concurrent code who need to pick the correct primitive every time — and to come out the other side of lockdep with their design intact.

Prerequisites

Solid CKRN-110-level module developmentUserspace concurrency concepts

Course outline

Day 1 — Spin or sleep

  • Spinlocks, mutexes and semaphores: when each applies
  • What you may not do while holding a spinlock
  • Interrupt context rules and the irqsave/irqrestore variants
  • Lock ordering and the anatomy of an AB-BA deadlock
  • The sleeping-while-atomic failure class

Day 2 — Read-mostly and lockless-lite

  • Reader-writer locks and seqlocks and their trade-offs
  • Per-CPU variables and local locks
  • RCU as a locking alternative at concept level
  • Atomics and reference counting: atomic_t, refcount_t, kref
  • Completions as a coordination tool

Day 3 — Proving it correct

  • lockdep: enabling it, reading its reports and trusting them
  • Lock classes, chains and what a splat is telling you
  • False positives and the annotations that fix them
  • KCSAN for data-race detection
  • Capstone workshop

Hands-on labs

Labs follow the academy model — 35% principles, 20% guided investigation, 45% engineering studio. Every claim you make in a lab is backed by a trace, a counter or a measurement you captured yourself. How we teach

  1. Lab: write a module with a deliberate AB-BA deadlock, catch it with lockdep and fix the ordering
  2. Lab: convert a lock-heavy critical section to per-CPU variables and measure the contention change
  3. Lab: trigger a sleeping-in-atomic warning deliberately and trace exactly why it fired
  4. Lab: run KCSAN over a racy test module and fix the race it reports
  5. Lab: choose between spinlock, mutex and seqlock for a stated access pattern and defend the choice with measurements

Capstone project

Take a small concurrent kernel component from works-in-testing to defensible: locking design documented per data structure, clean under lockdep and KCSAN stress runs, with a written rationale for every primitive chosen and every lock ordering established — ready to survive maintainer review.

What you leave with

  • A decision procedure across spinlock, mutex, rwlock, seqlock and per-CPU
  • Interrupt-context and sleeping rules internalised
  • lockdep and KCSAN as daily tools
  • Deadlock analysis by lock chain rather than by staring

How it runs

Every course follows the same model: 35% principles, 20% guided investigation, 45% engineering studio. You leave with working code, raw measurements and an evidence-based report — not a certificate of attendance. Read the methodology or see a full sample lesson.

Material is adapted to your kernel version, hardware and workload before a private delivery. For public cohorts, the environment is provided and configured.

Questions

Who is this course for?

Kernel and driver developers writing concurrent code who need to pick the correct primitive every time — and to come out the other side of lockdep with their design intact. It sits at practitioner level within the Linux Kernel Core track.

What do I need to know already?

Specific prerequisites for this course: Solid C; KRN-110-level module development; Userspace concurrency concepts. We confirm levels before the cohort starts and adapt if a group is stronger or weaker than expected.

Can this run privately for my team?

Yes. Any course runs on-site at your offices anywhere, or live online for a distributed team, with labs adapted to your hardware and codebase.

What is the difference between in-person and online?

In person is 3 full days with hardware on your desk, capped at 14. Online is 6 half-day sessions across about two weeks so you can keep working, capped at 20, with remote lab access.

Do you invoice companies?

Yes. Purchase orders are accepted and invoicing is available in USD, EUR, GBP, SAR and CAD.

Upcoming dates

DatesWhereSeatsEarly birdRegular
8 Nov – 10 Nov 20263 full days RiyadhIn person · KAFD Conference Centre 6 of 14 SAR 7,090until 9 OctSAR 7,880
8 Nov – 10 Nov 20263 full days Kuwait CityIn person · Al Hamra Tower 11 of 14 KWD 580until 9 OctKWD 650
15 Nov – 17 Nov 20263 full days MuscatIn person · Knowledge Oasis Muscat 6 of 14 OMR 730until 16 OctOMR 810
22 Nov – 29 Nov 20266 half-days Gulf bandLive online · 09:00–13:00 GMT+3 12 of 20 US$1,350until 23 OctUS$1,500
23 Nov – 25 Nov 20263 full days OttawaIn person · Kanata North Tech Park 11 of 14 CAD 2,570until 24 OctCAD 2,860
23 Nov – 25 Nov 20263 full days TorontoIn person · MaRS Discovery District 6 of 14 CAD 2,570until 24 OctCAD 2,860
23 Nov – 30 Nov 20266 half-days Europe bandLive online · 09:00–13:00 CET 17 of 20 US$1,350until 24 OctUS$1,500
30 Nov – 2 Dec 20263 full days LondonIn person · Shoreditch Works 11 of 14 GBP 1,480until 31 OctGBP 1,640
30 Nov – 7 Dec 20266 half-days Americas bandLive online · 13:00–17:00 ET 6 of 20 US$1,350until 31 OctUS$1,500
7 Dec – 9 Dec 20263 full days BerlinIn person · Factory Görlitzer Park 6 of 14 EUR 1,740until 7 NovEUR 1,930

Dates shown for the next few months. If nothing fits, tell us where and when — cohorts are added on demand, and private delivery can be scheduled any week.

More in Linux Kernel Core

KRN-1013 days Kernel Architecture & Source Navigation A guided tour of the kernel tree: how it is organised, how subsystems relate, and how to find the code you need. Foundation Practitioner-taught SAR 6,750Next 18 Oct KRN-1022 days Building & Configuring the Kernel Configure, build, install and boot a kernel you compiled yourself, and understand what the thousands of config options actually do. Foundation Practitioner-taught SAR 4,500Next 18 Oct KRN-1103 days Modules & the Kernel Build System Kbuild, module loading, symbol resolution and the module lifecycle from insmod to rmmod. Foundation Practitioner-taught SAR 6,750Next 15 Nov KRN-2014 days Process Lifecycle & Scheduling How processes are created, scheduled and destroyed, and how scheduling decisions show up as latency in your application. Practitioner Practitioner-taught SAR 10,500Next 8 Nov KRN-2103 days CFS to EEVDF Internals The fair scheduler in depth, the move to EEVDF, and what changed for latency-sensitive workloads. Advanced Practitioner-taught SAR 9,000Next 18 Oct KRN-2112 days CPU Isolation & Affinity Taking CPUs away from the kernel for latency-critical work: isolcpus, nohz_full, RCU offload and the gotchas. Advanced Practitioner-taught SAR 6,000Next 25 Oct KRN-2204 days Virtual Memory & Page Tables Address spaces, page tables, faults and mappings — the machinery behind every memory access your program makes. Practitioner Practitioner-taught SAR 10,500Next 22 Nov KRN-2213 days Allocators: Buddy, Slab, vmalloc How the kernel allocates memory at every scale, and how allocator behaviour surfaces as fragmentation and latency. Advanced Practitioner-taught SAR 9,000Next 22 Nov KRN-2223 days Memory Pressure, OOM & cgroup v2 What happens when memory runs out: reclaim, swap, the OOM killer, and cgroup v2 limits that throttle silently. Advanced Practitioner-taught SAR 9,000Next 22 Nov KRN-2313 days RCU in Depth Read-copy-update from first principles: grace periods, publish-subscribe, and why RCU is everywhere in the kernel. Advanced Practitioner-taught SAR 9,000Next 8 Nov KRN-2323 days Memory Barriers & the Kernel Memory Model The hardest correctness topic in the kernel: reordering, barriers, and reasoning about concurrent code that actually holds. Expert Practitioner-taught SAR 10,120Next 8 Nov