TRT
Sign in

Core · Module 5 · Lesson 2 of 12

File Descriptors and Kernel File Tables

Trace how the kernel resolves integer file descriptors through the three-table architecture, evaluate shared file offsets, and inspect descriptor limits.

Pro — members onlyAbout 16 minutes

By the end you can

  • Trace integer file descriptors through the per-process descriptor table, system-wide open file table, and inode table
  • Differentiate shared file offsets across dup/fork from independent offsets across separate open calls
  • Identify the lowest-available-descriptor allocation rule used by the POSIX kernel
  • Inspect and configure process file descriptor resource limits using getrlimit

Builds on Opaque Pointers and API Encapsulation.

01 · A question first

Why does calling lseek() on a file descriptor advance the read position in an entirely different process after fork(), whereas opening the same file twice in one process keeps their read positions completely independent? The answer lies in the kernel's three-table architecture.

Make a guess before you read on.

02 · The idea

Members only

Unlock the full lesson

This lesson is part of the membership. Join to read it in full, along with every other premium deep dive.

What's inside

  • Start with the problem
  • How the idea works
  • Why it is correct
  • What it costs
  • Pitfalls and variations
  • Where it is used

03 · Practice

Something wrong with this lesson? Report a problem