Next: Distributed Systems
Up: 4560
Previous: Page Replacement Algorithms
  Contents
- files are logical units mapped onto physical secondary storage
- file name: logical object
- physical objects: blocks on disk, tape, optical disk
- one or more sectors: smallest unit to read from or write to disk
- block: unit of I/O transfer from disk to memory
- - improves efficiency
- secondary storage: nonvolatile
- file attributes: type, location, size, protection, time, date, user ID
- volatility: frequency of additions and deletions
- activity: percentage of records accessed during time frame
- directories: keep track of files (and are files themselves)
- create the illusion of compartments
- but are indexes to files which may be scattered
- entry per file: name, attributes, disk address, etc.
Files: Abstract Data Type [205]
- data (the file) and the operations on the file
- create: allocate storage, add to directory
- open: search directory
- - establish logical pointer current-file-position
- write: data at the pointer
- read: data at the pointer
- reposition: the pointer (seek)
- delete: file entry in directory
- truncate: update length attribute in directory
- append: new data and update length attribute in directory
- rename: change name in directory
- close: disconnect logical access to file
- access methods:
- sequential: only increment pointer
- direct: set pointer for seek
- indexed: index of keys and associated direct pointers
Files: Layered Systems [206]
application programs
logical file system: symbolic file name (directories)
file-organization module: logical block addr TO physical block addr
basic file system: read/write physical blocks
I/O control (device drivers): memory TO/FROM disk system
devices
Files: Partitions - Directories on Disk [207]
- partitions = minidisks = volumes
- virtual disks
Files: General Graph Directory [208]
- single-level: one directory shared by all users
- two-level: one directory per user
- tree-structured: long pathnames
- graph-structured: sharing
Files: Contiguous Allocation of Space [209]
- simplest method is a contiguous set of blocks
- disk address of start (base) block and length (in blocks)
- sequential access is easy - read next block
- direct access (``seek'') is easy -
- logical offset = physical base + offset
- how to find space for new file?
- first-fit: first hole that is big enough
- best-fit: smallest hole that is big enough
- external fragmentation
- blocks are available but not sequentially
- internal fragmentation
- preallocation of blocks is too large
- left-over amount in last block
Files: Contiguous Allocation [210]
Files: Linked Allocation [211]
- solves external fragmentation: can use any block for any file
- solves ``preallocation'' internal fragmentation
- good for sequential access: chase the pointer
- not effective for direct access
- where is the nth block of the file?
- requires space for pointers
- if a pointer is bad, file is lost
Files: Linked Allocation [212]
Files: Indexed Allocation [213]
- contiguous: easy sequential and direct access but fragmentation
- linked: no fragmentation but difficult direct access
- indexed: direct access and no fragmentation
- bring all pointers into one location: the index block (IB)
- each file has its own IB
- ith entry in the IB points to the ith block
- suffers from wasted space (IB may not be full)
Files: Indexed Allocation [214]
Files: How Large an IB? [215]
- each file must have an IB - IB should be small
- some files are small - IB should be small
- some files are big - IB should be large
- solution: multiple levels of smaller IBs
- some files are small - don't need multiple levels
- solution: UNIX Index Block
- 1 direct block of pointers to data (good for small files)
- indirect blocks (i-nodes) for multiple levels
Files: UNIX inode [216]
Files: Free-Space Management [217]
- free-space list records all blocks that are free
- allocate blocks (create, append): search list and remove
- deallocate blocks (delete): add to list
- implementations:
- bit vector: bit=1 IMPLIES block is free
- grouping
- first block has n-1 addresses of free blocks and 1 address of the next group
- counting: blocks are often given up in contiguous sets
- keep a list of pairs (first block, count)
- linked list: add/delete blocks at head
Files: Linked Free-Space List [218]
Files: Protection - Access Matrix [219]
| domain / object |
F1 |
F2 |
F3 |
printer |
| D1 |
read |
|
read |
|
| D2 |
|
|
|
print |
| D3 |
|
read |
execute |
|
| D4 |
read/write |
|
read/write |
|
- process in domain D1 can read file F1
- matrix is sparse
- access (column) list - each object has list of domain, rights-set
- process in domain D_i accesses O_j: scan j's list for permission
- capability (row) list - each domain has list of object, rights-set
- process in domain D_i possesses a capability to allow access
- list is a protected object and is accessed indirectly
Next: Distributed Systems
Up: 4560
Previous: Page Replacement Algorithms
  Contents
Ted Billard
2001-11-17