operating-systems file-management

Definition

File Types

Operating systems distinguish between file types to determine how they should be handled, interpreted, and executed.

Regular Files

ASCII Files

Lines of text. Portable and editable with any text editor.

Binary Files

Arbitrary bit sequences. Includes:

  • Data files: Specific to an application
  • Executables: Programs the OS can run

Executable Format

Executable Structure

The OS must interpret the internal structure (e.g., ELF in Linux, PE in Windows):

  • Magic Number: Bit pattern identifying the file type
  • Header: Metadata (file size, entry point)
  • Text Segment: Machine code instructions
  • Data Segment: Initialised variables
  • Symbol Table: Debugging and dynamic linking information

Directories

Directories

Special system files maintaining file system structure. Map file names to identifiers or metadata. See File Directory.

Special Files

Character Special Files

Represent devices managing data as a stream of characters (e.g., terminals, serial ports).

Block Special Files

Represent devices handling data in fixed-size blocks (e.g., hard disks).