File

A file is a collection of related information recorded in a second storage such as magnetic disks, magnetic tapes and visible disks. Typically, a file is a sequence of bits, bytes, lines or records whose meaning is defined by the file creator and user.

File Format

File Format should be in accordance with the format required for the application to understand it.

  • A file has a specific structure defined by its type.
  • Text file is a sequence of letters arranged in rows.
  • Source file is a sequence of processes and functions.
  • Object file is a sequence of bytes arranged in understandable mechanical blocks.
  • Where the app defines the various file formats, and contains a code to support these file formats. Unix, MS-DOS supports low file format number.

File type

File type refers to the ability of an application to distinguish different file types such as text files, source files and binary files etc. Many operating systems support multiple file types. Operating systems such as MS-DOS and UNIX have the following file types -

Ordinary files

  • These files contain user information.
  • This can be a document, information or operating system.
  • The user can apply various functions to files such as add, modify, delete or delete the entire file.

Directory files

  • These files contain a list of file names and other information related to these files.

Directory files

  • These files are also known as device files.
  • These files represent the visible device such as disks, terminals, printers, networks, tape drive etc.

These files are of two types -

  • Special character files - data is handled by character as in the case of terminals or printers.
  • Block special files - data is managed in blocks as in disk format and tapes.

File Access Methods

File access method specifies how the file records can be accessed. There are several ways to access files-

  • Sequential access
  • Direct / random access
  • Indexed sequential access

Sequential access

Sequential access is where records are obtained in a certain order, that is, the information in the file is processed sequentially, one record in a row. This access method is the oldest. Example: Compilers often access files this way.

Direct/Random access

  • Random file editing provides direct access to records.
  • Each record has its own address on file with its help which can be directly accessed in reading or writing.
  • The records do not have to be in sequence within the file and do not need to be located near the repository.

Indexed sequential access

  • This method is built on the basis of successive access.
  • The index is designed for each file that contains directions to various blocks.
  • The index is searched sequentially and its index is used to directly access the file.

Space Allocation

Files allocated to disk space by application. Apps use to follow three main ways to allocate disk space to files.

  • Contiguous Allocation
  • Linked Allocation
  • Indexed Allocation

Contiguous Allocation

  • Each file has a matching address field on disk.
  • The given disk address is in sequence.
  • Easy to use.
  • External segregation is a major problem with this type of distribution strategy.

Linked Allocation

  • Each file contains a list of links to disk blocks.
  • The directory contains a link / directory to the first file block.
  • There is no external separation
  • Used successfully in consecutive access file.
  • Not applicable in case of direct access.

Indexed Allocation

  • Provides solutions to problems with integrated and connected sharing.
  • The reference block is created with all file directories.
  • Each file has its own index block that stores addresses in the disk space that resides in the file.
  • Directory contains the address addresses of the file blocks.