File descriptors and object lifetime

Follow a descriptor to an open file description with its offset, see which calls share that offset, and learn when a file really goes away. Filesystems and storage · Operating systems.

One program reads 8 bytes through a descriptor, copies the descriptor, reads 8 more, then opens the file again. Where is each reader, and what if the file's name is deleted meanwhile?

What you will learn

  • Trace a descriptor through an open file description to the file
  • Predict which calls share an offset and which start a new one
  • Explain why a file survives its last name while it is open

Lesson outline

  1. Three layers behind an integer
  2. Following the offsets
  3. A forked child shares the offset
  4. Tracking names and open descriptions

15 minutes · 4 scenes · 0 predict checks · 8 quiz questions

The full lesson is available with Premium.