HomeJOBSExamFile Management in Operating System

File Management in Operating System

File Management in Operating Syste

What is File System?

  • A file is a collection of correlated information which is recorded on secondary or non-volatile storage like magnetic disks, optical disks, and tapes. It is a method of data collection that is used as a medium for giving input and receiving output from that program.
  • In general, a file is a sequence of bits, bytes, or records whose meaning is defined by the file creator and user. Every File has a logical location where they are located for storage and retrieval.

Objective of File management System

Here are the main objectives of the file management system:

  • It provides I/O support for a variety of storage device types.Minimizes the chances of lost or destroyed data. 
  • Helps OS to standardized I/O interface routines for user processes.
  • It provides I/O support for multiple users in a multiuser systems environment.

Properties of a File System

Here, are important properties of a file system:

  • Files are stored on disk or other storage and do not disappear when a user logs off.
  • Files have names and are associated with access permission that permits controlled sharing.
  • Files could be arranged or more complex structures to reflect the relationship between them.

File structure

A File Structure needs to be predefined format in such a way that an operating system understands . It has an exclusively defined structure, which is based on its type.

Three types of files structure in OS:

  1. A text file: It is a series of characters that is organized in lines.
  2. An object file: It is a series of bytes that is organized into blocks.
  3. A source file: It is a series of functions and processes.

File Attributes

A file has a name and data. Moreover, it also stores meta information like file creation date and time, current size, last modified date, etc. All this information is called the attributes of a file system.

Here, are some important File attributes used in OS:

  • Name: It is the only information stored in a human-readable form.
  • Identifier: Every file is identified by a unique tag number within a file system known as an identifier.
  • Location: Points to file location on device.
  • Type: This attribute is required for systems that support various types of files.
  • Size: Attribute used to display the current file size.
  • Protection: This attribute assigns and controls the access rights of reading, writing, and executing the file.
  • Time, date and security: It is used for protection, security, and also used for monitoring

File Access Mechanisms

File access mechanism refers to the manner in which the records of a file may be accessed. There are several ways to access files −

  1. Sequential access
  2. Direct/Random access
  3. Indexed sequential access

 

  1. Sequential access

A sequential access is that in which the records are accessed in some sequence, i.e., the information in the file is processed in order, one record after the other. This access method is the most primitive one. Example: Compilers usually access files in this fashion.

2. Direct/Random access

  • Random access file organization provides, accessing the records directly.
  • Each record has its own address on the file with by the help of which it can be directly accessed for reading or writing.
  • The records need not be in any sequence within the file and they need not be in adjacent locations on the storage medium.

3. Indexed sequential access

  • This mechanism is built up on base of sequential access.
  • An index is created for each file which contains pointers to various blocks.
  • Index is searched sequentially and its pointer is used to access the file directly.

Space Allocation

Files are allocated disk spaces by operating system. Operating systems deploy following three main ways to allocate disk space to files.

  1. Contiguous Allocation
  2. Linked Allocation
  3. Indexed Allocation

1. Contiguous Allocation

  • Each file occupies a contiguous address space on disk.
  • Assigned disk address is in linear order.
  • Easy to implement.
  • External fragmentation is a major issue with this type of allocation technique.

2. Linked Allocation

  • Each file carries a list of links to disk blocks.
  • Directory contains link / pointer to first block of a file.
  • No external fragmentation
  • Effectively used in sequential access file.
  • Inefficient in case of direct access file.

3. Indexed Allocation

  • Provides solutions to problems of contiguous and linked allocation.
  • A index block is created having all pointers to files.
  • Each file has its own index block which stores the addresses of disk space occupied by the file.
  • Directory contains the addresses of index blocks of files.

People also ask 

1.What is the file management in operating system?

Ans: A file management system is used for file maintenance (or management) operations. It is is a type of software that manages data files in a computer system.

2.What are the operations involved in file management?

Ans: Operation performed on directory are:

Search for a file.

Create a file.

Delete a file.

List a directory.

Rename a file.

Traverse the file system.

3.What are the types of file management?

Ans: 6 Best File Management System

4.What are the 3 types of files?

Ans: There are three basic types of special files: FIFO (first-in, first-out), block, and character.

4.What are basic file operations?

Ans: These four basic file operations are Copy, Move, Rename, and Delete.

5.What is good file management?

Ans: Good File Management Makes Finding What You Want Easy

6.What data type is a file?

Ans: A FILE is a type of structure typedef as FILE.

7.What are the basic file operations in C?

Ans: Different operations that can be performed on a file are:

Creation of a new file (fopen with attributes as “a” or “a+” or “w” or “w++”)

Opening an existing file (fopen)

Reading from file (fscanf or fgets)

Writing to a file (fprintf or fputs)

Leave a Reply

Most Popular

Recent Comments

Translate »
error: Content is protected !!