the open-file table
When you open a file, the OS does not look it up afresh on every single read. That would be like re-finding a library book on the shelf for every word you read. Instead, when you open a file the OS makes a small in-memory bookmark that remembers everything it needs while the file is in use: where the file's metadata is, where you currently are in it, what you are allowed to do. The open-file table is the collection of these bookmarks.
There are actually two levels of table working together. There is a system-wide open-file table with one entry per distinct open file across the whole machine, holding shared facts like the file's location on disk and a count of how many openers are currently using it (its reference count). And there is a per-process table, one for each running program, holding that program's own handles. A handle in your per-process table points at an entry in the system-wide table, which in turn points at the file's metadata. The crucial per-open detail, the current position you are reading or writing at, lives in the shared open-file structure, which is why two separate opens of the same file each get their own independent position.
Why it matters: this two-level design is what lets many programs (and many parts of one program) share files cleanly and lets the OS reclaim resources at exactly the right moment. The system-wide entry's reference count is the safety mechanism: the OS only truly closes the file and frees its in-memory structures when the LAST holder closes it. A common confusion is thinking your file descriptor stores the position itself, it does not, it indexes into these tables where the real state lives.
Two programs open the same config file. The system-wide table has one entry for that file with reference count 2; each program's per-process table has its own handle pointing to it. When the first program closes, the count drops to 1; only when the second also closes does the OS release the entry.
Per-process handles point into a system-wide table; a reference count guards release.
The OS frees an open file's in-memory structures only when the LAST opener closes it (reference count reaches zero). Forgetting to close leaks slots in these limited tables.