Skip to content

The Offset Remembers

Exercise: 50k_file_descriptors · Tue Dec 1 · Length: 6:38 · Lecture: Week 15 · The offset makes a descriptor stateful · Explainer: The Offset Remembers

A narrated walk through the explainer, for after the Nov 24 lecture and before Tuesday's session (Dec 1): the place a descriptor has reached in its file is kept in its entry in the process's file table, and each read starts there. The video reads where that place is kept, then steps through the given cat reading an example file under cargo run, one system call at a time, watching each call's answer, the entry's offset and cat's buffer. Two opens of the same file follow, read in turn. A broken case follows, a kernel whose read answers the wrong count, with what was typed into cargo run and what it printed. The video ends on what you write, the test's own programs, and how a failure reads. It shows no solution code: only the table entry, each call's answer, the offset and the buffer at each step, with an example file, or the test's own.

Download the video (MP4, 8 MB) · Captions (WebVTT) · All eleven Week 15 videos