explaingit

mit-pdos/xv6-public

9,404CAudience · researcherComplexity · 4/5Setup · moderate

TLDR

xv6 is a tiny Unix-like operating system written at MIT in C, small enough to read completely, used worldwide in university courses to show exactly how processes, memory, files, and hardware interact inside a real OS kernel.

Mindmap

mindmap
  root((xv6))
    Purpose
      Teaching OS internals
      MIT 6.828 course
    Core concepts
      Processes and scheduling
      Virtual memory
      System calls
      File system
    Architecture
      Written in C
      Targets x86
    Status
      Archived x86 version
      RISC-V version active
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study how an operating system handles processes, memory management, and system calls by reading the complete source code without wading through millions of lines

USE CASE 2

Follow MIT's 6.828 Operating System Engineering course using xv6 as the hands-on kernel project

USE CASE 3

Add a new system call to xv6 as a homework exercise to understand how user-space programs request kernel services

Tech stack

Cx86 Assembly

Getting it running

Difficulty · moderate Time to first run · 1h+

Requires QEMU or a compatible x86 emulator to run, note this repo targets the older x86 architecture, active development has moved to the RISC-V xv6 repo.

In plain English

xv6 is a small operating system written at MIT, modeled closely on Unix Version 6, which was an early version of Unix from the 1970s created by Dennis Ritchie and Ken Thompson at Bell Labs. The goal of xv6 is not to be a production system you would actually run on a real computer. It exists as a teaching tool for computer science students learning how operating systems work from the inside. The code is written in C and targets x86 processors, which are the type found in most personal computers. Because xv6 is small enough to read in full, students can follow the path a program takes from the moment a user runs a command all the way through scheduling, memory management, file storage, and hardware interaction, without wading through the millions of lines that make up real operating systems like Linux. This particular repository covers the x86 version, which the maintainers have stopped updating. Active development has moved to a newer version of xv6 that targets RISC-V processors, a more modern and openly licensed chip architecture commonly used in academic work today. The MIT course that uses xv6, numbered 6.828, has accompanying online materials and a long history of contributors who have submitted bug fixes and improvements over the years. If you are looking at this repository because you want to study how an operating system works at the level of processes, system calls, and memory, xv6 is one of the most widely used starting points in university courses worldwide. The codebase is intentionally kept compact and plain, which is exactly the point.

Copy-paste prompts

Prompt 1
Walk me through how xv6-public handles a fork() system call from user space all the way through the kernel, which files are involved and in what order do they execute?
Prompt 2
Explain xv6's virtual memory layout: how does it map user memory and kernel memory, and which source files implement the page table management?
Prompt 3
I'm adding a new system call to xv6. List every file I need to edit, what to add to each, and why the change is needed
Prompt 4
How does the xv6 round-robin scheduler work? Show me the relevant function in proc.c and explain how context switching happens
Prompt 5
Trace what happens in xv6 when a user program calls write() on a file, from the system call entry point through the file system down to the disk driver
Open on GitHub → Explain another repo

← mit-pdos on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.