CSE Roadmap

Common tier · about 3 hours · 8 parts

Part 6 of 8 · 3 min read

Storage and security questions

Think of a post office with a sorting machine, a safe, and a row of locked boxes. Each part has a job, and a good clerk can say which part is at fault when a parcel is lost. The analogy stops in one place: a clerk can see the machine, and a kernel's parts are visible only through files and counters.

In plain words: Model answers:

  1. What is an inode? A record in a file system with a file's size, owner, permissions, times and block map. It does not hold the file's name: names are entries in directories that point to inodes (Level 9).
  2. Hard link or symbolic link? A hard link is another name for the same inode, and the inode counts its links. A symbolic link is a small file that holds a path, and can dangle (Level 9).
  3. How does journaling help? The file system writes the intended change to a log first and applies it after, so that after a crash it can replay or drop the log and stay consistent (Level 9).
  4. Why does df show full when du does not? A deleted file that is still open keeps its space, and sparse files, reserved blocks and inodes can also differ (Level 9, case study).
  5. What is a Linux capability? One named piece of the power of root, so a process can have just one, for example binding a low port (Level 10).
  6. Container or VM? A VM virtualises hardware and runs its own kernel, and a container shares the host kernel with namespaces for the view and cgroups for the limits (Level 11).
  7. How should passwords be stored? As salted, slow hashes (Level 10).

A worked example. A RAID 5 array has 5 disks of 2 TB. One disk's worth of space holds parity, so the usable capacity is (5 - 1) x 2 TB = 8 TB, and the array survives one disk failure (Level 8). A second example: the group-commit idea of Level 8 explains why a database that calls fsync once for each group of 64 writes is far faster than one that calls it after every write. The syncer test of page 4 did one fsync per 4 KiB write, and reached about 11,961 of them per second on a fast virtual disk.

The key lines. For each question, give the one-sentence definition, say which level or tool makes it concrete, and offer to go deeper. This is what a prepared answer looks like.

Copy-on-write

Copy-on-write is a technique in which several users share the same data until one of them writes, and only then is a private copy made. It is used for fork (pages), snapshots and container image layers.

Example: after fork, parent and child share pages, and a write by either makes a copy of that page.

Check yourself: 1. Where is a file's name stored? 2. What is the usable capacity of a RAID 5 array of 4 disks of 3 TB? 3. Why does a container start faster than a VM?