cs341 Lecture Notes Spring 2002 Week 9, Thursday For today you should have: 1) written a solution to the next semaphore problem and labelled it Semaphore Problem #8 2) continued work on homework 6 3) done the practice exam 4) read Nutt pages 425 and 426 on UNIX file structure. For next time you should: 1) prepare for the exam 2) read Section 13.5 and the reading notes below Topics for today: 1) file systems (still notes14.txt) 2) practice exam problems 3) Unix index blocks Unix index blocks ----------------- What's wrong with one big, honking table of indices? Inode contains indices of first 12 blocks, plus a pointer to the 1) single indirect block 2) double indirect block 3) triple(!) indirect block How big can a file be? Two limiting factors: 1) number of indices that can fit in the index block 2) number of different blocks that can be addressed What are the performance tradeoffs: 1) small files fast (and most files are small) 2) vast majority of files don't need indirection blocks 3) large files pay a little more in per-block access time (which can be mitigated by caching the indirect blocks) Section 13.5: Directories ------------------------- In UNIX, the ln command creates a link, which is a second reference to an existing file. Links make the difference between a strictly hierarchical directory structure and an acyclic graph. A directory is basically a table that makes it possible to look up a file name and get the location of the file's inode. In the simplest version, we have to search for the file linearly, but it is easy to think of improvements. Naturally, we would like to store directories as files, taking advantage of the file abstraction. In the diagram on page 441, I think it is clearer to imagine that directory b replaces directory a (which is usually empty). For example, on the Linux machines, you can type ls /mnt/zip And it's probably empty. Then put in a zip disk and type mount /mnt/zip If it succeeds, you can type ls /mnt/zip again and you will get the top-level directory on the zip disk. Unfortunately, many of the zip disk drives in the Linux lab don't work. We are looking into it.