Lecture Notes for Operating Systems
Implementing File Systems, 27 November 2000
- implementing files
- the disk abstraction - an array of fixed-sized blocks
- disk-block allocation
- sequential -
- good - fast and simple to do and use
- bad - static maximum file sizes required; external fragmentation
- linked list - each block contains a pointer to the next block;
- good - reasonably fast allocation, no external fragmentation;
- bad - slow random access, data and meta-data mixed.
- indexed list - an primary memory representation of the disk array
- good - fast; data and meta-data separate
- bad - could be a huge list
- index nodes - disk blocks of indexed lists; unix
- good - fast; huge
- bad - complex
- disk block size
- depends on disk geometry (sector, track, and cylinder), system
considerations (page size)
- disk space utilization (drops as page size grows) vs data transfer
rates (increases as page size grows)
- free block management
- bit maps vs. linked lists using disk blocks
- one block primary memory cache
- implementing directories
- cp/m directories - flat
- user code (1), file name (8), extension (3), extent (1) block count
(1) disk block numbers (15)
- ms-dos directories - hierarchical
- file name (8), extension (3), attributes (1), time (2), date (2),
first disk block number (2), size (4)
- an index into a file-allocation table
- unix directories - hierarchical
- i-node number (2), file name (14) - i-node leads to the next
directory level, or the file itself
- performance
- millisecond access times - caching
- a block of buffers between the disk and the rest of the os
- should be invisible except for peformance gains
- full caches need to be flushed - like paging
- file system consistency - writes to the disk go to the disk
- modified lru - important immediately, infrequently first, frequently
last
- putting writes to disk - periodic flushes to disk or write-through
- removable media - synchronizing with non-write-through caches
caches
- disk clustering - putting associated things close together
- data and directories within the same cylinder
- interleaving sectors within a cylinder
- centerally locating meta-data within the disk or cylinder groups
- log-structured file systems
- everything's getting better except for disk seek times
- large, fast primary caches reduce disk accesses to writes - small
writes (data and meta-data)
- writes go to a segment; when full the segment gets written to disk
- reads are as before
- i-node maps keep track of the most recent i nodes
- a scavenger thread cleans up old segments, freeing them for further
use
- raid - redundant array of inexpensive (or independent disks)
- lots of reliable, fast disk storage cheap
- basic idea - parallel reads and writes to multiple disks
- reliability through redundancy, ecc, or both
- levels of raid performance - originally five, now who knows
- raid 0 - parallel disks storing blocks; no reliability
- raid 1 - parallel disks with mirroring; reliability through
redundancy
- raid 2 - parallel disks; byte interleaved; data and ecc disks
- raid 3 - data are striped across parallel data disks; stripe parity
is stored on separate disk
- raid 4 - non-striped data written to parallel disks; block parity
stored on separate disk
- raid 5 - parity and data disks combined; block writes
This page last modified on 29 November 2000.