Files
Persistant store of data.
Structure
Most commonly
- An ordered sequence of bytes. Interpretation of bytes is left to application programs. Filesystem imposes no particular structure.
Sometimes (not so much in recent OSs):
- A sequence of characters. Special meaning is attached to, for example, new-line characters, and end-of-file character.
- A sequence of records (e.g. in CP/M, a file is a sequence of 128-byte records). Allows random access to records in the file. Filesystem works in terms of reading and writing records.
- A tree of records (i.e. sorted by some key). The filesystem maintains the tree in sorted order and retrieves keyed records on behalf of client.
Most modern OSs do not impose an interpretation on the content of files. Files are just a sequence of bytes. But! Directories (and soft links) are often implemented as (special) files, which have a structure understood by the filesystem, and which is hidden from user applications. Also! The structure of executable files is to some extent imposed by the OS...
Operations
Files typically support following operations:
- CREATE
- DELETE
- OPEN
- CLOSE
- READ
- WRITE
- SEEK (move to an arbitrary position in the file)
Often other operations are supported, usually combinations of above operations. For example, may be able to open a file in 'append' mode, to write data to the end of the file. This would be the same as OPENing the file normally, and SEEKing to the end.
Representation
-
file name
-
type (file data-type, directory, link)
-
size
-
owner
-
protection
-
creation/modification time
-
blocks containing data
This information may be stored directly in a directory entry, or may be encapsulated in an inode.
last updated 3 April 1998