
Build the xv6 kernel from scratch for x86 and xv architectures, learning multiprocessor support, virtual memory with multi-level page tables, uart console drivers, and the layered file system.
Download course zipped files for xv6 operating system kernel design from scratch in C program.
Compile and run xv6 with qemu, build the boot image using make, then create simple.c, add it to the makefile, and test echoing input.
Learn how kernel starts with the kernel.ld linker script and entry.s, maps memory and device drivers, and sets per-core stacks of four kilobytes from the core id.
Describe configuring the machine mode status register and mpp to supervisor, writing mepc, enabling the machine timer interrupt, and wiring the timer vector to timer vec for timer-driven scheduling.
Learn how spin locks and sleep locks protect shared data from race conditions in the xv6 kernel, covering initialization, acquisition, release, and how interrupt control prevents deadlocks.
Explore how xv6 sets up and uses multi-level page tables, satp, sv39 sv48 sv32, maps virtual memory to physical addresses, and manages memory allocation and freeing.
Map a process's memory by creating and growing its page table with UVM create and UVM alloc, then map, copy, and manage pages, including unmap and copy for fork.
Explain kernel virtual memory functions in xv6, including kvm init and work address, how uvm creates and maps process page tables, and how exec loads segments.
Explore how the platform level interrupt controller manages and multiplexes external interrupts, routes them to cores, and uses priority, enable, and threshold registers in xv6's interrupt design.
Set up trap handling by configuring supervisor and machine mode vectors and saving/restoring registers in the kernel trap. Implement timer interrupts, scheduling via yield, and sleep using ticks.
Map traps in user mode by using a trampoline and per-process trap frames, saving and restoring registers via user vec and user trap return, handling system calls and timer interrupts.
Explore virtio memory mapped io in xv6, enabling virtual disk i/o via memory mapped registers, feature negotiation, queues, and descriptors to access a host block device in qemu.
Explain how the kernel and host communicate for virtual disk I/O by using interrupt-driven reads/writes, a shared available/used ring, and descriptor buffers managed by the driver.
Explore how buffer management enables concurrent memory access through a circular doubly linked buffer cache with valid bits, ref counts, and disk io via bread and beget mechanisms.
Discover how the disk logging mechanism preserves consistency by buffering writes to a log block before updating data blocks, supporting recovery, begin op, end op, and commit handling.
Explore how xv6 maps memory blocks using bitmaps, detailing the superblock, inode and data blocks, and bitmap-based block allocation and indirect addressing.
Explore the inode-based file and directory structures in xv6, learn how blocks, direct and indirect addressing, and bitmaps enable accessing, reading, and updating inodes via directory lookup and bmap.
Explore the file system in xv6 kernel design, covering file structure, inodes, pipes, file table and operations: open, close, read, write, dupe, and stat, with locking.
Examine the xv6 pipe design, detailing a pipe structure with read and write pointers, a lock, and files created by pipe alloc for reading and writing, open and close semantics.
Explore how the xv6 kernel manages processes from init to zombie using procinit, allocproc, fork, reparent, and userinit, covering process states, context switching, and the scheduler.
Learn how to set up system calls in xv6 from user space via user.h, the 21 system calls, and the trap mechanism, including loading ELF programs with exec.
The xv6 is a multi-core processor kernel designed for educational purposes. This operating system kernel runs successfully on qemu virtual machine and has options for extending the features. In this 8hrs long course, you will learn how to write the C program code from scratch and understand several operating systems concepts used including:
1. How to initialize kernel subsystems - e.g process, memory, disk, interrupts, trap, mode.
2. You learn the different kernel operating modes - machine mode, supervisor mode, user mode and how to switch between the modes.
3. How to protect shared memory data using spin locks and sleep locks on a multi-core processor.
4. Hardware virtualization - How to link external hardware e.g keyboard and display using 16550a UART chip.
5. Virtual memory addressing and how virtual memory is mapped to physical memory.
6. How to generate system calls from user mode including how its transition ad execution in supervisor mode
7. How timed operations like sleep(), scheduling is managed in an operating system using timer interrupts.
8. Disk management techniques including buffering, bit-mapping, logging etc.
9. How hardware virtualization is used enable disk access from virtual machine to host system using VIRTIO memory mapped registers.
10. File management technique - how to store files and directories as inodes, pipes and device files on disk and in memory.
11. Process management and scheduling techniques - process creation, process allocation and process manipulation techniques