About This Course
Course Overview
This course explores the complete vertical stack of a computing system — from digital logic and number systems through the processor pipeline, assembly language, and operating system internals, concurrency, and file systems. Through a hands-on OS assignment, students build a minimal kernel in C and x86-32 NASM assembly, starting from a raw 512-byte MBR bootloader and culminating in a working RAM-disk file system running inside QEMU.
All lecture slides and notes align with Stallings, Computer Organization and Architecture, 10th edition. Every figure, section, and exercise cites the exact Stallings reference. Exam-style exercises with mark allocations appear throughout each lecture.
Course Materials
Lecture Slides & Notes
Hardware Fundamentals
Lectures 1–4 · Digital Systems & Computer Organisation
Processor Architecture & ISA
Lectures 5–7 · Performance, Pipelining & Assembly
Operating System Core
Lectures 8–9 · Processes, Scheduling & OS Assignment Stage 0–1
Concurrency, Memory & File Systems
Lectures 10–12 · OS Assignment Stages 2–4
Implementation Blog
OS Assignment Articles
A deep-dive into the x86 boot sequence. We write a 512-byte MBR in NASM, load the kernel via INT 0x13 extended read, set up a minimal three-entry GDT, transition the CPU from 16-bit Real Mode to 32-bit Protected Mode by setting CR0 bit 0, execute the mandatory FAR JUMP to flush the pipeline, and land in kernel_main(). We then build a text-mode VGA driver writing directly to 0xB8000 and a PS/2 keyboard driver for a working line-editing shell.
Extension Ideas for Students
- Full ISO keyboard layout with Shift, CapsLock, and numeric keypad support in the scancode table
- VGA scrolling buffer — circular ring, Page-Up / Page-Down support
- ANSI escape-code colour support (
ESC[31m…ESC[0m) in the VGA driver - Command history (up/down arrow) with a 20-entry ring buffer
- Tab-completion scanning the command table for prefix matches
- Replace the custom bootloader with a GRUB2 multiboot header and load as a standard ELF binary
We design the pcb_t struct (state, stack pointer, entry point, PID), implement create_process(), program the i8253 PIT for 100 Hz clock interrupts on IRQ0, and write a PUSHAD/POPAD context-switch stub in NASM. The shell gains a ps command that displays all PCBs.
Extension Ideas for Students
- Multi-level feedback queue (MLFQ) with 3 priority bands and ageing to prevent starvation
sleep(ms)syscall using the PIT tick counter and a wake-time-sorted sleep queuefork(): duplicate the PCB, copy 4 KB stack, return 0 to child and child PID to parent- CFS-style virtual runtime (
vruntime) with a sorted run-queue for proportional-share scheduling
We extend the kernel with lightweight kernel threads sharing a process's address space, implement a blocking mutex_t and a counting semaphore_t. The classic myglobal race condition demonstrates the problem — with and without a mutex. A bounded-buffer producer-consumer validates all three semaphores working together.
Extension Ideas for Students
- Priority inheritance in the mutex: boost the lock holder's priority to the highest waiter's level
- Read-write lock (
rwlock_t): concurrent readers, exclusive writers with starvation prevention - Deadlock detector: periodically walk the resource-allocation graph with DFS looking for cycles
- Implement the Readers-Writers problem with writer starvation prevention using a turn variable
We parse the BIOS E820 memory map from the boot stage, build a bitmap (1 bit per 4 KB frame), and implement pmm_alloc_frame() and pmm_free_frame(). The shell gains a meminfo command showing total / used / free frame counts. Kernel identity-mapping ensures physical == virtual addresses throughout.
Extension Ideas for Students
- Buddy allocator to reduce external fragmentation for multi-frame contiguous requests
- Virtual memory manager: software-managed page table +
#PFhandler for demand paging - Slab allocator:
kmalloc(n)/kfree(p)for variable-size kernel heap objects on top of the frame allocator - Clock-algorithm page replacement when physical frames are exhausted — swap to the RAM disk from Stage 4
The final stage builds a POSIX-inspired file system on a 1 MB RAM disk. We implement a superblock, a bitmap for blocks and inodes, a flat directory structure, and a full open / read / write / close / unlink interface. Shell commands ls, touch, cat, and write validate the complete system.
Extension Ideas for Students
- Single-indirect block pointer in the inode — expand max file size from 32 KB to 4 MB + 32 KB
- Subdirectories:
mkdir / cd / pwdwith a per-process current-directory pointer stored in the PCB - Write-ahead journaling (8 KB log) so the FS survives a simulated crash and can replay on next mount
- VFS abstraction layer:
file_ops_tvtable shared by the RAM disk FS and a second ROM read-only FS
Tools & Materials
Additional Resources
Textbook
Stallings, Computer Organization and Architecture, 10th Ed. All figures cited in every lecture.
Lecture Plan
12-week schedule with weekly objectives, Stallings chapters, and assignment milestones.
OS Starter Kit
Stage 0 source: Makefile, boot.asm, C kernel, VGA & keyboard drivers, QEMU run script.
Toolchain Setup
Ubuntu: apt install nasm gcc qemu-system-i386 make gdb. macOS: brew install nasm qemu.
Student Guide
Environment setup, Makefile targets, QEMU+GDB debugging workflow, and submission checklist.
Submission
Private GitLab repo. Tag each stage: v0.1-stage0 through v0.5-stage4 for grading.
Progression
Learning Path
Syllabus
Course Structure
Part I: Hardware Fundamentals (L01–L04) — Computer organisation and registers, memory hierarchy and DMA, number systems and Boolean algebra, combinational and sequential logic, FSM design, and architecture taxonomy (CISC/RISC/Von Neumann/Harvard).
Part II: Processor Architecture & ISA (L05–L07) — ALU and control unit design, ISA formats and addressing modes, CPU performance, pipelining, hazards, branch prediction, Flynn's taxonomy, ILP, x86-32 NASM assembly, and the boot sequence.
Part III: OS Core (L08–L09) — OS objectives, services, and interface layers; process control blocks; five-state and seven-state process models; context switching; and CPU scheduling algorithms (FCFS, SJF, SRTF, Round-Robin, Priority).
Part IV: Concurrency, Memory & File Systems (L10–L12) — Threads, mutual exclusion, semaphores, deadlocks, Banker's Algorithm, page replacement, file allocation methods, i-node multi-level indirection, x86 protection rings, and OS security goals.