210 likes | 315 Views
CS423UG Operating Systems. File Systems - V. Indranil Gupta Lecture 27 10/28/2005. Content. File systems Space management Performance Reliability. Implementing Files. UNIX inode. Implementing Directories (1). (a) A simple directory Fixed-size entries (e.g., MS-DOS)
E N D
CS423UG Operating Systems File Systems - V Indranil Gupta Lecture 27 10/28/2005
Content File systems • Space management • Performance • Reliability CS 423UG Operating Systems. Indranil Gupta
Implementing Files UNIX inode CS 423UG Operating Systems. Indranil Gupta
Implementing Directories (1) (a) A simple directory Fixed-size entries (e.g., MS-DOS) Disk addresses and attributes in directory entry (b) Directory in which each entry just refers to an i-node CS 423UG Operating Systems. Indranil Gupta
Implementing Directories (2) • Two ways of handling long file names in directory (a) In-line or (b) In a heap CS 423UG Operating Systems. Indranil Gupta
Shared Files (1) How? • Linking • Opening CS 423UG Operating Systems. Indranil Gupta
Shared Files (2) (a) Situation prior to linking (b) After the link is created (c) After the original owner removes the file CS 423UG Operating Systems. Indranil Gupta
Free Space Management • Bit vector • A bit map is kept of free blocks • Each bit in a vector represents one block • If the block is free, the bit is zero • Simple to find n consecutive free blocks • Overhead is bit map • Example: BSD file system CS 423UG Operating Systems. Indranil Gupta
Free Space Management • Free list • Keep a linked list of free blocks • Not very efficient because linked list needs traversal • Example: V R1 system CS 423UG Operating Systems. Indranil Gupta
Free Space Management • Linked list of indices • A linked list of index blocks is kept • Each index block contains addresses of free blocks and • A pointer to the next index block • A large number of free blocks can be found quickly CS 423UG Operating Systems. Indranil Gupta
Free Space Management • Linked list of contiguous blocks that are free • The free list node consists of a pointer and the number of free blocks starting from that address • Blocks are joined together into larger blocks as necessary CS 423UG Operating Systems. Indranil Gupta
Disk Space Management (1) • Dark line (left hand scale) gives effective data rate of a disk • Dotted line (right hand scale) gives disk space efficiency • All files 2KB Block size CS 423UG Operating Systems. Indranil Gupta
Disk Space Management (2) CS 423UG Operating Systems. Indranil Gupta
Disk Space Management (3) Quotas for keeping track of each user’s disk use CS 423UG Operating Systems. Indranil Gupta
File System Reliability (1) • A file system to be dumped (stored as a whole, perhaps for backup) • squares are directories, circles are files • shaded items modified since last dump • each directory & file labeled by i-node number File that has not changed CS 423UG Operating Systems. Indranil Gupta
File System Reliability (2) • (above) Logical dump - Bit maps used for (all passes start at root) • (alternative) Physical dump would simply backup entire disk • first pass of tree to mark modified files and dirs • second pass to unmark some dirs • mark inodes that need to be dumped, dump marked dirs • dump marked files CS 423UG Operating Systems. Indranil Gupta
File System Reliability (3) • File system states • (a) consistent • (b) missing block • (c) duplicate block in free list • (d) duplicate data block (c) (d) CS 423UG Operating Systems. Indranil Gupta
File System Performance (1) • The buffer cache – speeding up disk access CS 423UG Operating Systems. Indranil Gupta
File System Performance (2) (a) I-nodes placed at the start of the disk (b) Disk divided into cylinder groups • each with its own blocks and i-nodes CS 423UG Operating Systems. Indranil Gupta
Log-Structured File Systems • With CPUs faster, memory larger • disk caches can also be larger • increasing number of read requests can come from cache • thus, most disk accesses will be writes • Writes are frequent, and are done in small chunks • LFS Strategy structures entire disk as a log • have all writes initially buffered in memory • periodically write these to the end of the disk log (append) • when file opened and read, locate i-node, then find blocks, return resultant file (processed) to application CS 423UG Operating Systems. Indranil Gupta
Summary • File concepts - file attributes, operations, structures • Firectory systems - single-level, two-level, tree structure, acyclic structure, general structure • Access and storage methods • Reading for File Systems: relevant parts of Chapter 6. • Reading for next week: Chapter 8. • HW4 due next Wednesday (Nov 2) CS 423UG Operating Systems. Indranil Gupta