File Management

Some files contain an internal structure, which may or may not be known to the OS. For the OS to support particular file formats increases the size and complexity of the OS.

UNIX/Linux treats any file as a sequence (array) of bytes, with no further consideration of the internal structure. (With the exception of executable binary programs, which it must know how to load and find the first executable statement, etc.)

Disk files are accessed in units of physical blocks, typically 512 bytes or some power-of-two multiple thereof, like 1024 = 1K, 2048 = 2K, 4096 = 4K, and 8192 = 8K. So, if you wish to read only 100 bytes from a file, the OS will return you, for example, 4K of bytes, out of which you (or your program) will need to extract these 100 bytes.

Internally files are organized in terms of logical units, which may be as small as a single byte, or may be of a larger size corresponding to some data record or structure size.