80 likes | 278 Views
CS 415 Operating Systems Principles File System Implementation. Dr. Edward C. Cheng. File System. File system layering architecture File Control Block (FCB) Directory. Files. Logical File System. File management modules. Basic File System. I/O functions. Devices.
E N D
CS 415 Operating Systems Principles File System Implementation Dr. Edward C. Cheng
File System • File system layering architecture • File Control Block (FCB) • Directory
Files Logical File System File management modules Basic File System I/O functions Devices File System Layering Architecture
File System Basic Structure • FS: volume directory, file and block • Disk: platter, track and sector (512 bytes) • Formatted vs. unformatted • Boot sector (boot block) • Contains necessary info for the OS to boot up • Volume control block • Contains info of the volume • File control block (FCB) • Contains attribute info of each file • Open-file table • Keep an entry for each opened file
File Control Block • Location (file path) • Owner • Permission (rwx) • Size • Space allocation (block) info
Directory Implementation • Performance consideration • Search by filename frequently when creating, deleting, accessing or searching of a file • Create a hash table to contain all directory entries • At boot time, read the directory hash table into memory • Create a hash table for each of the directory to contain all files within the directory (name and pointer to FCB) • When a directory is open, read the file hash into memory and also cache up the relevant FCB’s
Space Allocation for Files • Contiguous allocation • File location is simply beginning block# + length • +ve: fast access • -ve: external fragmentation; extending file size is costly • Linked allocation • The file initially only points to the first block of the file • +ve: no external fragmentation • -ve: slow for direct access to certain block of a file • Solution: FAT • Indexed allocation • Use an index block to keep pointers to all blocks • +ve: fast direct access • -ve: index block may not be in memory
Next Class Disk I/O and Performance