Skip to main content

Need of naming; Sun NFS

Short answer

Naming provides location independence, sharing, and resolution of resources. SUN NFS features a VFS layer, NFS client/server using RPC, file handles, mount service, and stateless operation with caching for access transparency.

Why is naming necessary in distributed system? Explain Sun Network File System architecture with its features.

Need of naming

A name identifies a resource (file, host, service, user). Naming is necessary because:

  • Users and programs refer to resources by names, not by addresses or identifiers.
  • Names are location independent, so a resource can move or be replicated without clients changing.
  • Names allow sharing of resources among users (the same name gives the same resource).
  • A name service finds the attributes (address) of a named resource (name resolution), for example DNS.
  • It gives uniqueness, grouping (directories) and access control on resources.

Sun NFS

SUN NFS (Network File System) is the most widely used distributed file service, developed by Sun Microsystems. It lets a client access remote files as if they were local, over an RPC-based protocol that is independent of the operating system, hardware and network.

Architecture

 Client computer                       Server computer
 +-----------------------------+       +-----------------------------+
 | Application programs        |       |                             |
 |-------- UNIX kernel --------|       |-------- UNIX kernel --------|
 |    Virtual file system      |       |    Virtual file system      |
 |      |              |       |       |       |              |      |
 | +----v-----+  +-----v-----+ |       | +-----v-----+  +-----v----+ |
 | | UNIX     |  | NFS       | |       | | NFS       |  | UNIX     | |
 | | file     |  | client    | |       | | server    |  | file     | |
 | | system   |  |           | |       | |           |  | system   | |
 | +----------+  +-----+-----+ |       | +-----+-----+  +----------+ |
 +---------------------|-------+       +-------|---------------------+
                       |                       |
                       +<---- NFS protocol --->+
                              (RPC over UDP/TCP)
  • Virtual file system (VFS): a layer in the kernel that decides whether a request is for a local file or a remote file and passes it to the UNIX file system or to the NFS client. It keeps a v-node for each open file; the v-node holds an i-node reference for a local file or a file handle for a remote file.
  • NFS client: translates VFS operations into RPC requests to the server.
  • NFS server: receives requests, identifies the file by its file handle (file system id, i-node number, i-node generation number), and calls the local file system.
  • Mount service: a client mounts a remote directory into its local file tree. The server lists the file systems it exports in /etc/exports, and the client records each mounted remote directory in its mount table.
  • Automounter: mounts a remote directory on first use.

Operation

  1. The application issues a system call (for example read).
  2. The VFS finds that the file is remote and calls the NFS client.
  3. The NFS client sends an RPC (lookup, read, write, getattr, create, remove, mkdir, readdir...) over UDP/TCP using XDR encoding.
  4. The NFS server's VFS finds the local file by the file handle, runs the operation on the local file system and returns the result.
  5. The client caches the data (block cache) and attributes. Cache validity is checked by comparing timestamps; a cached entry is trusted for a freshness interval of about 3–30 seconds for files and 30–60 seconds for directories.

Features / properties

  • Access and location transparency through mounting.
  • Stateless server: each request carries all the information needed, so a crashed server restarts without recovery work; operations are idempotent.
  • Heterogeneity: works with any OS that implements the protocol.
  • Caching: read-ahead and delayed write for performance, with approximate (not strict one-copy) consistency.
  • Security: the original version trusted the user id sent in the RPC; later versions use Kerberos.
  • Limited replication and migration support.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 2 questions →