Library / Books
Operating Systems: Three Easy Pieces
A free, readable operating-systems textbook covering virtualisation, concurrency and persistence.
By Remzi and Andrea Arpaci-Dusseau · University of Wisconsin · Added 2026-10-12
All content belongs to Remzi and Andrea Arpaci-Dusseau / University of Wisconsin. We only link to it and give credit. Report a problem
Learn this book
About 37 min left. Your work is saved as you go.
Why read this book now
University of Wisconsin publishes this book. Choose a chapter that matches what you are studying now, rather than starting at page one.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Low-Level Design Practice · 11 minChess gameBoard, pieces and rules: polymorphic pieces that generate moves, validating turns and check, and keeping the board model separate from the UI.Read here
The problem
Two players take turns on an 8 by 8 board. The system validates moves, detects check, checkmate and stalemate, and records the game.
Entities
100%Figure SDA-LLD-12-1 · Chess classes · © forcsguy.com
Inheritance is justified here: each piece type is a real kind of piece with its own movement rule.
Pieces know their own movement
abstract class Piece { constructor(readonly color: "W" | "B") {} abstract legalMoves(board: Board, from: Pos): Pos[]; // ignoring check } class Rook extends Piece { legalMoves(board: Board, from: Pos): Pos[] { return slide(board, from, [[1,0],[-1,0],[0,1],[0,-1]], this.color); // along rank and file until blocked } } class Knight extends Piece { legalMoves(board: Board, from: Pos): Pos[] { return [[1,2],[2,1],[-1,2],[-2,1],[1,-2],[2,-1],[-1,-2],[-2,-1]] .map(([dx, dy]) => ({ x: from.x + dx, y: from.y + dy })) .filter((p) => board.inside(p) && board.pieceAt(p)?.color !== this.color); } }A helper
slideis shared by rook, bishop and queen so the logic is not repeated.Validating a move
100%Figure SDA-LLD-12-2 · Validating a move · © forcsguy.com
Game status: check if the opponent's king is attacked; checkmate if in check with no legal move; stalemate if not in check but no legal move.
Moves as objects
class Move { constructor(readonly from: Pos, readonly to: Pos, readonly captured?: Piece, readonly kind: "normal" | "castle" | "enPassant" | "promotion" = "normal") {} } class History { done: Move[] = []; undone: Move[] = []; play(m: Move, b: Board) { b.apply(m); this.done.push(m); this.undone = []; } undo(b: Board) { const m = this.done.pop(); if (m) { b.revert(m); this.undone.push(m); } } }A move object makes undo, redo, history and notation straightforward: this is the Command pattern.
Design notes
- Special rules: castling (neither piece has moved, path clear and not attacked), en passant (needs the previous move), promotion (choose a piece). Each needs a little extra state:
hasMovedon pieces, last move on the game. - Model and view stay separate; an AI or network player implements the same
Playerinterface. - Clocks are a separate component observing the turn.
- Extensions: a move-suggestion engine, saved games, variants with different boards, online play with a server validating every move (never trust the client).
Real-world reading
Related reading
- Operating Systems: Three Easy PiecesRemzi and Andrea Arpaci-Dusseau · University of WisconsinBooks
- Ambry: Distributed Immutable Object Store at LinkedInLinkedIn engineers · LinkedInCase Studies
- Cloud Object Store at YahooYahoo engineers · YahooCase Studies
- Netflix: What Happens When You Press Play?High Scalability engineers · High ScalabilityBlogs
Show 6 moreShow fewer
- 8 Things You Need to Know Before a System Design InterviewGainlo engineers · GainloBlogs
- The Dataflow Model (paper)Akidau et al. · GooglePapers
- Atomic Object Engineering BlogAtomic Object engineers · Atomic ObjectBlogs
- Cloud Bouncer: Distributed Rate Limiting at YahooYahoo engineers · YahooCase Studies
- Object StorageDatacenterknowledge engineers · DatacenterknowledgeCase Studies
- Remind Engineering BlogRemind engineers · RemindBlogs
- Special rules: castling (neither piece has moved, path clear and not attacked), en passant (needs the previous move), promotion (choose a piece). Each needs a little extra state:
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Operating Systems: Three Easy Pieces.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…