Memory Allocation and the Allocator: What malloc Actually Does
When you called malloc(64) in the C course — or every time Ruby created an object, or Python grew a list — something had to find 64 free bytes in the heap, mark them used, and han…
Memory Management and File Systems covers: Memory Allocation and the Allocator, Swapping, Copy-on-Write, and Memory-Mapped Files, File Systems, Journaling, Crash Recovery, and Disk Scheduling, Virtualization and the Ruby Garbage Collector. Year 2, Quarter 6. Includes 13 exercises and 3 projects.
This course unlocks once you've finished its prerequisite. Open prerequisite →
Complete prerequisites first to enroll.
When you called malloc(64) in the C course — or every time Ruby created an object, or Python grew a list — something had to find 64 free bytes in the heap, mark them used, and han…
The virtual-memory course gave you the mechanism — page tables mapping virtual to physical. This lesson is where that mechanism does its most clever tricks. Three of them, each a …
Every file you've ever saved is a lie told well. A file looks like a contiguous stream of bytes with a name and a folder — but underneath, its data is scattered across the disk in…
Pull the power cord out of a running computer. When it boots back up, why isn't the file system a corrupted mess? You were, after all, potentially halfway through writing a file —…
This lesson closes the Operating Systems block with two ideas that sit at opposite ends of the abstraction ladder but share a common root — and then makes them concrete in the lan…
- [ ] OSTEP Ch13: Address Spaces — Draw memory layout of a C program: text, data, heap, stack - [ ] OSTEP Ch14: Memory API — Write programs demonstrating malloc/free errors, check…
- [ ] OSTEP Ch18: Paging Introduction — Simulate address translation with page table - [ ] OSTEP Ch19: TLBs — Measure TLB size by timing array accesses at different strides - [ ] …
- [ ] xv6 Lab: Page tables — Add a page that maps kernel info into user space - [ ] xv6 Lab: Copy-on-write fork — Implement COW fork in xv6 - [ ] Implement a log-structured file s…
- [ ] Build a FUSE file system in C — Mount a virtual file system that stores data in a single flat file; implement open, read, write, readdir, getattr; test with standard UNIX to…
Implement mymalloc and myfree using a free list with first-fit allocation. Track allocations, detect double-frees, and report memory leaks at program exit. A simplified version of…
Implement an in-memory file system with inodes, directory entries, and data blocks. Support create, read, write, delete, ls, and cat. Data lives in a flat binary file that persist…
Write a Ruby script that uses ObjectSpace and GC.stat to monitor garbage collection behavior. Allocate objects in various patterns (rapid allocation, long-lived objects, circular …
- [ ] Explain paging. How does a virtual address get translated to a physical address? - [ ] What is copy-on-write? How does fork() use it? - [ ] What is thrashing? What causes it…
- [ ] Course 6.1 knowledge check passed - [ ] Course 6.2 knowledge check passed - [ ] Unix Shell capstone completed
14 lessons. Read in order; spiral back when you need to. By the end you'll have used the core ideas twice — once on the abstract, once on something you'll meet at work next week.