File system: abstracts the secondary memory into a logical view
File vs. Memory
File
- External device
- Stream (conceptually no limit on size)
- ex) fwrite
Memory
- Virtual memory space
- Predefined size
- ex) malloc
HDD’s virtual structure
General specification

- A sector size is 512 bytes
- A cluster contains four sectors (2KB)
- A block size is 4KB
Secondary memory as linked list
- Insensitive to size
- Discontinuous structure
- Open-ended


File as an interface of an external device

Buffered/Non-Buffered

- A file involves input buffer and output buffer
- Buffered I/O :
- Efficient: Smaller number of accesses to a device
- Delayed response: Buffering needs data to wait in buffer
- Non-buffered I/O:
- Inefficient: Greater number of accesses to device
- Immediate response: I/O data transfers right away
- Flush: transfer Buffered data immediately
- usually apply to output buffer
Synchronous/Asynchronous
A process sends a request to OS by a system call
- Synchronous: process waits until the request is finished
- Asynchronous: process doesn’t wait for the end of the request