Skip to content
SEE Exam Prep

Question 8 of 15 · CIE-2 QB · Set 2 · 6 marks

Open in ChatGPT

Distinguish between NFS and AFS based on architecture, caching mechanisms, consistency, and file access.


Introduction

NFS and AFS are the two classic network file systems. Both let a client use a remote directory as if it were local; they differ in how the server is structured, how the client caches, and therefore how consistent a shared file looks.

Architecture

  • NFS is a stateless server: each call (LOOKUP, READ, WRITE) carries the file handle, and the server keeps no per-client state. Mounting is done by the client's mount protocol, and file handles identify files across reboots.
  • AFS is stateful at session level: the client establishes a callback with the server, the server records which clients hold which files, and the server contacts the client when a file changes.

AFS architecture: workstations run the Venus cache manager above the UNIX kernel, and servers run Vice above their own kernel, all joined by the network

Caching

  • NFS caches file data and attributes on the client, with timestamps. A cached block is revalidated when it is older than a few seconds; attribute caching makes stat cheap.
  • AFS caches the whole file on the local disk and validates it through callbacks: the server promises to notify the client when the file changes.

Consistency

  • NFS gives close-to-open consistency: writes are flushed on close and a cached copy is revalidated on open, so a client sees changes made by another client after it reopens the file.
  • AFS gives session semantics per file: while a file is open the client holds it, and the callback guarantees the cached copy is invalidated as soon as another client writes.

File access

  • NFS performs fine-grained, per-block remote access; the server is contacted for blocks that are not cached.
  • AFS transfers whole files and works well over slow wide-area links, which is why it was designed for campus-wide file sharing.

Comparison

Point NFS AFS
Server state Stateless Callback state
Cache unit Blocks Whole files
Consistency Close-to-open Callback invalidation
Scale Local network Wide area, many clients
Failure of server Client retries Callback breaks, client revalidates

Conclusion

NFS trades weaker consistency for a stateless server that survives restarts easily; AFS trades server state for strong, cache-friendly consistency across a wide area.