H 4 Copy On Write Mappings
This page is a generated reference surface for selective reading. It exists to keep the learner apps guide-first while still preserving source access.
Learning objectives
- Explain the main ideas and vocabulary in H 4 Copy On Write Mappings.
- Work through the source examples for H 4 Copy On Write Mappings without depending on raw chunk order.
- Use H 4 Copy On Write Mappings as selective reference when learner modules point back to Ostep.
Prerequisites
- None curated yet.
Module targets
module-02-memory-management-virtual-memorymodule-04-file-systems-io
AI companion modes
- Explain simply
- Socratic tutor
- Quiz me
- Challenge my understanding
- Diagnose my confusion
- Generate extra practice
- Revision mode
- Connect forward / backward
Source-of-truth note
This unit is anchored to Ostep and the source chapter "H 4 Copy On Write Mappings". Use external resources only to clarify, extend, or modernize details without replacing the chapter's conceptual spine.
External enrichment
No chapter-specific enrichment resources are curated yet. Add them in the unit manifest when a source clearly improves learning.
Source provenance
- Primary source:
Ostep - Source chapter: H 4 Copy On Write Mappings
- Raw source file:
264-h-4-copy-on-write-mappings.md
Merged source
H 4 Copy On Write Mappings
H.4 Copy-on-write Mappings
This project adds the ability to perform a lightweightfork(), called vfork(), to xv6. This new call doesn't simply copy the mappings but rather sets up copy-on-write mappings to shared pages. Upon reference to such a page, the kernel must then create a real copy and update page tables accordingly.
H.5 Memory mappings
An alternate virtual memory project is to add some form of memorymapped files. Probably the easiest thing to do is to perform a lazy page-in of code pages from an executable; a more full-blown approach is to build anmmap()system call and all of the requisite infrastructure needed to fault in pages from disk upon dereference.
H.6 Kernel Threads
This project explores how to add kernel threads to xv6. Aclone() system call operates much like fork but uses the same address space. Students have to figure out how to implement such a call, and thus how to create a real kernel thread. Students also should build a little thread library on top of that, providing simple locks.
H.7 Advanced Kernel Threads
Students build a full-blown thread library on top of their kernel threads, adding different types of locks (spin locks, locks that sleep when the processor is not available) as well as condition variables. Requisite kernel support is added as well.
H.8 Extent-based File System
This first file system project adds some simple features to the basic file system. For files of type EXTENT, students change the inode to store extents (i.e., pointer, length pairs) instead of just pointers. Serves as a relatively light introduction to the file system.
H.9 Fast File System
Students transform the basic xv6 file system into the Berkeley Fast File
System (FFS). Students build a newmkfstool, introduce block groups and a new block-allocation policy, and build the large-file exception. The basics of how file systems work are understood at a deeper level.