Chapter 3

The Lab Notebook

Four hands-on assignments in C, on Linux and real hardware. Click a card to flip it.

⏱️

Real-time Task Models in Linux

Periodic and aperiodic tasks, scheduled in parallel.

tap to flip ↻

Implemented real-time task models on Linux where periodic and aperiodic tasks run side by side. Verified the schedule by recording context switches with trace-cmd and inspecting them in KernelShark, pinned to a chosen CPU core.

  • C
  • Linux
  • pthreads
  • trace-cmd
  • KernelShark
View on GitHub ↗
🌈

PWM & Distance Measurement on Raspberry Pi

A software-PWM RGB LED and an ultrasonic rangefinder.

tap to flip ↻

Drives an RGB LED with software PWM using timers and measures distance with an HC-SR04 ultrasonic sensor on a Raspberry Pi 4B. Includes a small kernel module for reading CPU cycle counts, plus a command prompt to set duty cycles and take measurements.

  • C
  • Raspberry Pi 4B
  • GPIO
  • PWM
  • Kernel module
View on GitHub ↗
🧮

Kernel Hash Tables via a Device File

Talk to a kernel data structure with open, read, write.

tap to flip ↻

A Linux character-device driver that creates two devices, each backed by its own in-kernel hash table. User programs manipulate the tables through the ordinary open / read / write / close file interface. Built and tested on a Raspberry Pi 4B.

  • C
  • Linux kernel
  • Device driver
  • Hash table
View on GitHub ↗
💡

SPI & Distance-Controlled Text Scroller

Wave your hand to change how fast the text scrolls.

tap to flip ↻

A kernel driver for the HC-SR04 ultrasonic sensor feeds a userspace app that talks SPI to a MAX7219 LED matrix. The distance to your hand sets the scrolling speed of the text on the matrix.

  • C
  • SPI
  • MAX7219
  • HC-SR04
  • Raspberry Pi 4B
View on GitHub ↗