Chapter 12
File System Management

User vs. system view of a file

User: Collection of bytes (Unix) of records or objects (IBM)

System: collection of blocks (a block is a logical transfer unit [4k in Unix] while a sector is the physical transfer unit).


Translating from user to system view

What happens if the user says: Give me bytes 12-20?

Fetch block corresponding to those bytes from memory
return the correct portion of the block to the user

What about Write bytes 12-20?

fetch block from memory
modify indicated portion of the block
write back block to memory


Everything in the system is in integer-sized blocks. For example, in Unix, getc and putc buffer 4096 bytes, even if the interface is one byte at a time.


File usage patterns

How do users access files?

  1. Sequential access -- bytes read in order starting at the beginning of the file.

  2. Random access -- read/write element out of the middle of an array,

  3. key-based access -- "Give me a hundred bytes starting with ADAM."

Most systems do not provide the third method directly. Instead an index is built on top of a random access memory.


How are files typically used?