File Operation

1)         Creating  a file:

                                                           A file is an abstract data type. The operating system can provide system calls to create, write, and read, respotion, delete, and truncate files.

          The two steps are necessary to create a file.

* Storage space in the file system must be found for the file.

* An entry for a new file must be made in directory. The directory entry records a name of the file and the location in the file system.

2)         Writing a file:

                           To write a file we make a

System calls specifying both the name of file and    the information to be written to the file. Give the name of the file, the system searches the directory to find the file’s location of the file system mast keep a write pointer to the location in the file   where the next.

 

3)         Reading a file:

  To read from file, we use a

System call that specifies the name of the file and where the next block of the file should be put. Again directory entry is search for the associated directory and system need to keep a read pointer to the location of the file where the next read to take place.

 

                                     Once we read, a read pointer is updated a give process is usually only read or writing a given file and current operation location is kept as preprocess current file position pointer.

 

4) Repositioning a file:

                              The directory is search for the appropriate directory entry and the current file position is set to give values. Repositioning within a file system dose not need to involve any actual i10 it just remove all directory entry where ever you want to move the file.

 

5) Delete a file:

                                To, delete a file, we search the directory for the name file having a associated directory entry we realize all the file space from the secondary storage so that it can be reused by the other file and finally error the directory entry.

 

6) Truncating a file:

                                          The user may want’s to erase all the contain of the file but it attributes rather then forcing the user to delete a file and than recreating it this function allows all attributes remain an change expected for the file length but file reset to the length zero and the file space is relished.


Average Rating (0)
by dhruvi   chaudhari  in Operating System  on 3/3/2015 1:55:15 AM  


Post Your Comment
*