Concept of file and directories in OS

      Concept of file and directories

Introduction to file:-

A file is collection of specific information stored in the memory of computer system. File management is defined as the process of manipulating files in computer system, it management includes the process of creating, modifying and deleting the files.

In general file is sequence of bits , bytes ,lines or records.


The following are some of the tasks performed by file management of operating system of any computer system:
  1. It helps to create new files in computer system and placing them at the specific locations.
  2. It helps in easily and quickly locating these files in computer system.
  3. It makes the process of sharing of the files among different users very easy and user friendly.
  4. It helps to stores the files in separate folders known as directories. These directories help users to search file quickly or to manage the files according to their types or uses.
  5. It helps the user to modify the data of files or to modify the name of the file in the directories.
general hierarchy of the storage in an operating system
The above figure shows the general hierarchy of the storage in an operating system. In this figure the root directory is present at the highest level in the hierarchical structure. 

It includes all the subdirectories in which the files are stored. Subdirectory is a directory present inside another directory in the file storage system. The directory base storage system ensures better organization of files in the memory of the computer system.

The file management of function in operating system (OS) is based on the following concepts:
  1. File Attributes
    It specifies the characteristics of the files such as type, date of last modification, size, location on disk etc. file attributes help the user to understand the value and location of files. File attributes is one most important feature. It is uses to describe all the information regarding particular file.
  2. File Operations
    It specifies the task that can be performed on a file such as opening and closing of file.
  3. File Access permission
    It specifies the access permissions related to a file such as read and write.
  4. File Systems
    It specifies the logical method of file storage in a computer system. Some of the commonly used files systems include FAT and NTFS.
File attributes :-
1. Name -
2. Identifier 
3. Type
4. Size 
5. location
6. Protection
7. Time and date
8. User id 
File type :-
1. Text file :-  sequence of character organised into lines.
Its usual extension are txt, doc.

2. Source file :- sequence of submultilines or function. Usual extension are c, java ,pas, ASM ,a.

3. Object file :- collection of words organised into loader records blocks.
Usual extension are obj, o.

4. Executable file :-  read to run machine language program compiled . Usual extension are exe , com, bin.

File operations :-
1. Creating a file.
2. Reading a file.
3. Writing a file.
4. open a file.
5. Delete a file.
6. Truncate a file.
7. Append a file.
8. Close a file.

FILE DIRECTORIES:
Collection of files is a file directory. The directory contains information about the files, including attributes, location and ownership. Much of this information, especially that is concerned with storage, is managed by the operating system. The directory is itself a file, accessible by various file management routines.
Information contained in a device directory are:
  • Name
  • Type
  • Address
  • Current length
  • Maximum length
  • Date last accessed
  • Date last updated
  • Owner id
  • Protection information
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
Advantages of maintaining directories are:
  • Efficiency: A file can be located more quickly.
  • Naming: It becomes convenient for users as two users can have same name for different files or may have different name for same file.
  • Grouping: Logical grouping of files can be done by properties e.g. all java programs, all games etc.
SINGLE-LEVEL DIRECTORY
In this a single directory is maintained for all the users.
  • Naming problem: Users cannot have same name for two files.
  • Grouping problem: Users cannot group files according to their need.
file_sys_5

TWO-LEVEL DIRECTORY
In this separate directories for each user is maintained.
  • Path name:Due to two levels there is a path name for every file to locate that file.
  • Now,we can have same file name for different user.
  • Searching is efficient in this method.
file_sys_6

TREE-STRUCTURED DIRECTORY :
Directory is maintained in the form of a tree. Searching is efficient and also there is grouping capability. We have absolute or relative path name for a file.
file_sys_7
Thank you viewers..

Comments

Popular posts from this blog

Introduction of Digital computer

INTRODUCTION OF DBMS

Introduction to cache memory