To fight a disease after it has occurred is like trying to dig a well when one is thirsty or forging a weapon once a war has begun. Chinese MedicineFile Systems
Disks
![]() |
Disk Interleaving |
Tapes
drive #, surface ( side ), the track and the sector
all the tracks on one drive that can be accessed without being
moved constitute a cylinder
within a track, data are stored in sectors
in general,
block number b = k + s x ( j + i x t )
File Control Block ( FCB ) -- storage structure consisting of information about a file
| Typical File Control Block |
|---|
| file permissions |
| file dates ( create, access, write ) |
| file owner, group, ACL ( access control list ) |
| file size |
| file data blocks |
Allocation Methods -- an allocation method refers to how disk ` blocks are allocated for files:
Studies of UNIX environment shows that median file size is about 1K
if block size too large ( e.g. 32K ) => wasteful
if too small => a file consists of many blocks
=> data transfer too slow

in general, block size ~ 512, 1K, or 2K
Contiguous Allocation
Linked Allocation
Indexed Allocation
Bring all the pointers together into one location: the index block ( one for each file )
Free-space Management
linked list, grouping, bit map, counting
16-bit block #
1K block can have 512 16-bit entries
Thus, it can hold 512 free block #
Therefore, 128 M disk requires 256 blocks to hold all 128K disk block#
each block is represented by 1 bit
A disk with n blocks requires n bits
128 M disk with 1K blocks requires 128K bits or 16K bytes ( i.e. 16 blocks )
makes use of the clustering properties of file blocks
File Allocation Table ( FAT ) -- MSDOS, OS/2
UNIX
an i-node is associated with each file, containing information of the file
each block is 4KB
assume 4 bytes ( 32 bits ) pointers
direct blocks
single indirect:
double indirect:
triple indirect:
#ls -i -- displays inode numbers
CP/M
only one directory ( thus only need to search one directory ), which
contains fixed-size ( 32 bytes ) entries
when the OS finds the entry, it also has the disk block numbers,
if the file uses more disk blocks than fit in one entry ( max four disk
block numbers; each 16-bit ), the
file is allocated additional entry
| ||||||||
|
Hierarchical Directory

MS-DOS
| |||||||||
|
contains filename and first block number ( cluster # ), indexed to FAT
early UNIX
|
||
|
Suppose the root directory has node number #2. Here is a small part of a Unix file system tree, showing hypothetical node numbers:
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Note how one directory (#555) has three name-to-number maps for the same node. All three names (cp, ln, mv) refer to the same node number, in this case a file containing an executable program. (This program looks at its name and behaves differently depending on which name you use to call it.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||