File systems
הוצג
מילון מונחים
| English | משמעות |
|---|---|
| inode | A filesystem record storing file metadata and information locating file data. |
| journaling | Recording filesystem changes in a log to support recovery after interruption. |
English
Names, inodes, blocks
- The inode holds a file's metadata and 4 direct pointers plus one indirect block (256 pointers at 1 KiB each); the directory is itself a file of name-to-inode entries.
- Size bound: $(4 + 256) \times 1\,\mathrm{KiB} = 260$ KiB. With 4 KiB blocks: $(4 + 1024) \times 4\,\mathrm{KiB} = 4112$ KiB, about 4 MiB.

{exercise:uni-cs0705-layout}
אימונים
With 1 KiB blocks, 4 direct pointers and one 256-pointer indirect block, the max file is —
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
(4 + 256) x 1 KiB = 260 KiB.
English
The price of block 6
- Reading block 6 of /notes/x: the directory lookup finds the inode (cached); block 6 is beyond the four direct pointers — read the indirect block (pointer 2), then the data block: two disk reads for one logical block.
- Sequentially reading a 100-block file costs $100 + 1$ reads (the indirect block once). Deletion clears pointers, not data — the bytes stay until reused.
{exercise:uni-cs0705-price}
אימונים
Reading block 6 (beyond the direct pointers) costs — disk reads
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
The indirect block first (pointer 2), then the data block.
English
The crash question
- Append writes data, then the free-list bit, then the inode size. Crash between writes: data-then-inode loses only space (an orphan block); inode-then-data lies about size (reads return garbage).
- Journaling writes the intent first and replays it after the crash — the small write tax modern file systems pay for crash consistency.
{exercise:uni-cs0705-crash}
אימונים
Journaling survives crashes by —
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
The journal records what is about to happen; replay finishes it after the crash.