File System in Operating System - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Random Posts

File System in Operating System

Share This

Information must be stored and retrieved by all computer programs. A process can only store a certain amount of data in its own address space while it is active. The virtual address space's size, however, places a limit on the storage capacity. This size is sufficient for some uses, but it is considerably too small for others, including airline reservations, banking, or business record keeping.


Keeping data in a process' address space has the additional drawback of erasing it once the process has ended.


A third issue is the frequent requirement for numerous processes to simultaneously access (parts of) the information.


In order to store data on a disk and read it back later, files are an abstraction technique. The user must be kept in the dark about the specifics of how and where the information is stored and how the disks truly function.


A file may be a "free formed", "indexed," or "structured" collection of related bytes that only has meaning to the person who generated it. Or, to put it another way, the file is an item in a directory. Name, creator, date, type, permissions, and other elements of the file may exist.


File Structure


A file has various kinds of structures. Some of them can be:

  • Simple Record Structure with lines of fixed or variable lengths.
  • Complex Structures like a formatted document or reloadable load files.
  • No Definite Structure like a sequence of words and bytes etc.

Attributes of a File


Following are some of the attributes of a file :

  • Name: A human-readable form of file identifier.
  • Identifier. A unique tag (number) within a file system.
  • Type. Support different types of files.
  • Location. Pointer to file location on the device.
  • Size. The current size of the file.
  • Protection. Controls and assigns the power of reading, writing, and executing.
  • Time, date, and user identification. This is the data for protection, security, and usage monitoring.

File Access Methods


The way that files are accessed and read into memory is determined by Access methods. Usually, a single access method is supported by systems while there are OSs that support multiple access methods.


Sequential Access

  • Data is accessed from one record right after another in order.
  • The read command causes a pointer to be moved ahead by one.
  • The Write command allocates space for the record and moves the pointer to the new End Of File.
  • Such a method is reasonable for tape.


Direct Access

  • This method is useful for disks.
  • The file is viewed as a numbered sequence of blocks or records.
  • There are no restrictions on which blocks are read/written, it can be done in any order.
  • The user now says "read n" rather than "read next".
  • "n" is a number relative to the beginning of the file, not relative to an absolute physical disk location.


Indexed Sequential Access

  • It is built on top of Sequential access.
  • It uses an Index to control the pointer while accessing files.

What is a Directory?


Directories are responsible for maintaining file information. Multiple files can be found in a directory. Even directories may be contained within them. These directories are also referred to as folders in Windows. The following details are kept in a directory:

  • Name: A human-readable name visible to the user.
  • Type: Type of the directory.
  • Location: Device and location on the device where the file header is located.
  • Size: Number of bytes/words/blocks in the file.
  • Position: Current next-read/next-write pointers.
  • Protection: Access control on read/write/execute/delete.
  • Usage: Time of creation, access, modification, etc.
  • Mounting: When the root of one file system is "grafted" into the existing tree of another file system it's called Mounting.


Happy Exploring!

No comments:

Post a Comment