Lecture 19: File Systems 1 Flashcards
Character devices (keyboard, display, modem)
- input or output 1 character at a time
- data transfer: byte-at-a-time
Block devices (disk drive, tape drive)
- input/output data in fixed size blocks
- data transfer: block-at-a-time
Block
-amount of data read in one READ operation
Files
logically contiguous, non-volatile, protected collection of related data
Directories
special-purpose files that contain information about other files
File Systems
- allows for efficient and convenient access to disk
- resides on disk
- organized into layers
I/O Control
– lowest layer of OS abstraction
– consists of device drivers (software layer between
application and device controller)
– translates commands such as: retrieve block 123
to hardware-specific instructions used by controller
Basic file system
– issues generic commands to device driver to read, write blocks
– block-level addressing
File organization module
– translates logical block addresses (file id + block offset) to physical block addresses
(drive #, cylinder #, track #, sector #)
– includes free space manager for allocating, deallocating disk blocks
Logical file system
– manages metadata about files (e.g., size, permissions)
– maintains with file control blocks
File system data structures (on disk)
- Boot control block
• 1 per bootable partition
• info needed to boot OS from partition (bootstrap brings into RAM)
• stored in fixed location within partition (e.g., 1st block) - partition control block
• 1 per partition
• includes info about partition:
– # blocks, size of blocks, free-block count, free-block pointers, … - directory structure blocks
• 1 per directory
• file organization information for directory
4. file control block • 1 per file • typical contents: – permissions – timestamps (created, last access, last write) – owner – group – size – data block locations...
File system data structures (memory)
- PartitionTable
• information about all mounted (visible) partitions - DirectoryStructureTable
•information about recently accessed directories - Open File Tables
a) SystemOpenFileTable:
• copies of file control blocks (FCB’s) for every open file system-wide b) Process Open File Tables:
• lists of pointers to system open file entries for files opened by a process
Block Allocation
Comparing the Schemes
- Contiguous
- every file occupies a set of “contiguous” blocks on disk
+: good sequential, random access
-: poor disk utilization, files bounded in size
- Linked
file = list of disk blocks which can be scattered on disk
+: good sequential access, disk utilization, unbounded file size -: poor random access
- Indexed
• use dedicated “index blocks” to store pointers to data blocks
+: good disk utilization, unbounded file size,
good sequential, random access of few levels in index -: overhead of index blocks
access performance worsens with more levels
Free space management: Bit vector
• one bit per block
+: easy to find free blocks
easy to find contiguous blocks
-: can get very large, yet should be kept in memory
Free space management: linked list
• maintain pointer to 1st free block, which contains pointer to next free block, which contains pointer to next free block…
+: simple implementation little space overhead
-: traversing list is expensive, but typically you only need:
- 1st block in list: to allocate a frame
- last block in list: to deallocate a frame (keep 2nd pointer)