Source: Operating Systems: Three Easy Pieces (OSTEP) — Chapter 50, Arpaci-Dusseau & Arpaci-Dusseau
The Andrew File System (AFS)
CMU’s AFS (Satyanarayanan et al.) [H+88] aimed at scale: how many clients can one server support?
NFS burns server time on frequent cache-validity checks. AFS also wanted clear user-visible consistency: on open, you generally get a consistent latest copy — not NFS’s timeout-dependent fuzziness.
AFSv1 (ITC DFS)
Whole-file caching on the client’s local disk (Venus client / Vice servers):
open→ Fetch (full pathname) → write file to local diskread/write→ local FS only (may also hit client RAM cache)close→ if dirty, Store whole file back- Later access → TestAuth; reuse local copy if unchanged
Contrasts with NFS: whole files (not blocks), disk (not only memory). v1 cached file contents; directories stayed at the server.
Rank the sequence
1 / 1Order the AFSv1 whole-file caching lifecycle (top = first).
OrderDrag the handle to rearrange — top should be first.
- 1read/write hit the local disk copy (and maybe client RAM cache)
- 2close, if the file is dirty, Stores the whole file back to the server
- 3A later access does a TestAuth and reuses the local copy if unchanged
- 4open triggers a Fetch of the full file to local disk
Drag items into the correct order (or use ↑↓), then check.
What measurement found
Patterson’s Law: measure the problem before rebuilding.
| Problem | Effect |
|---|---|
| Pathname walks on Fetch/Store | Server CPU spent in directory traversal |
| Too many TestAuths | Like NFS GETATTR storms |
| (+ load imbalance, per-client processes) | Volumes + threads in v2 |
Result: ~20 clients per overloaded server.
AFSv2: callbacks + FIDs
Crux: redesign the protocol to cut server interactions and make remaining ones cheap.
- Callback: server promises to notify the client if a cached file/dir changes → client stops polling (interrupts vs polling)
- FID: volume ID + file ID + uniquifier (like an NFS file handle). Client walks the path one component at a time, caches each dir/file, and registers callbacks
First open of /home/remzi/notes.txt does several Fetches; afterward, if callbacks remain valid, opens are local. Scale rose to ~50 clients/server; common-case speed near local disk.
Rank the sequence
1 / 1Order the AFSv2 callback-based access to /home/remzi/notes.txt (top = first).
OrderDrag the handle to rearrange — top should be first.
- 1The next open after the break must re-Fetch from the server, since the cached copy is no longer trusted
- 2The first open walks the path one component at a time, Fetching and caching each dir/file, registering a callback for each
- 3A later open finds the callback still valid and is served entirely from the local cache
- 4The server later notices the file changed and breaks the callback, notifying the client
Drag items into the correct order (or use ↑↓), then check.
Cache consistency
| Scope | Rule |
|---|---|
| Different machines | Updates visible + remote caches invalidated at close (flush + break callbacks) |
| Same machine | Immediate visibility (UNIX-like) |
| Concurrent writers | Last closer wins — whole file from one client, not an NFS block mix |
DFS baseline consistency is for casual “log into another machine and see my files” — apps that care about concurrent updates still need locks.
Crash recovery (cost of state)
Callbacks live in server memory. Client reboot may miss callback breaks → treat cache as suspect; TestAuth before reuse. Server reboot forgets all callbacks → clients must revalidate. Heavier than NFS’s “just retry the stateless op.”
Performance vs NFS (qualitative)
Often similar on first fetch. AFS wins on large-file re-reads (local disk cache vs NFS re-fetch). AFS loses on overwrite (fetch then replace) and tiny I/O into huge files (always whole-file). Workload assumptions matter: AFS assumed infrequent sharing and whole-file sequential access.
Other improvements
True global namespace, serious security, flexible ACLs, admin tools for volumes. Marketplace favored open NFS/CIFS; AFS’s lasting influence is ideas (callbacks, clearer consistency) — NFSv4 even adds more server state.
Interactive
Try: goals · v1 limits · callbacks/FIDs · consistency · trade-offs.
Check your understanding
Andrew File System
1 / 6AFS’s primary design goal emphasized in this chapter is…
Pick an answer to see if you are right.
Coding challenges
Homework lab: afs.py
Use the OSTEP dist-afs homework (afs.py).
Homework: afs.py
0/3 startedSummary
| Idea | Takeaway |
|---|---|
| Scale | Cut server chatter (callbacks, path FIDs) |
| Whole-file + disk | Common case ≈ local FS |
| Consistency | Close visibility + last closer; simple story |
| Cost | Stateful recovery; bad for tiny/partial updates |
| Legacy | Ideas & tools; NFS/CIFS won the market |
Previous: Sun’s NFS
Next: Distributed systems dialogue / wrap-up (OSTEP Ch. 51+).
Further Reading
- Remzi & Andrea Arpaci-Dusseau — Operating Systems: Three Easy Pieces Ch. 50
- OSTEP AFS PDF
- OSTEP dist-afs homework
- Howard et al. AFS [H+88]; ITC DFS [S+85]