File Operations in Operating System:


Definition and Explanation:

A file can be considered as an abstract data type. The following abstract operations can be performed on files:


Creating a file: Two steps are needed to a file. First, space must be found for the file. Then an entry in the directory is created to illustrate that the file is there.

Writing a file: A system call is used to write a file. We provide a file identifier and the information to be written. The operating system performs the write. Operating system must maintain the write pointer in the file.

Reading a file: A system call is used to read a file. We provide the file identifier and the address where we want to read data. The operating system handles the read. The operating system must maintain the read pointer in the file. It is generally the same as the writing pointer.

Repositioning within a file: It is a process of moving the read/write pointer in the file or moving through the directory entries. It performs no I/O as the data structures that maintain the read/write code are in memory and can be updated in memory.

Deleting a file: The opera ting, system must provide the facility to delete a file. It frees the space allocated to the file and removes the file entry from the directory.

Truncating a file: Truncating a file means erasing the contents of the file but keeping the directory entry. The file will effectively be empty.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Blog Archive

Powered by Blogger.

- Copyright © 2013 Taqi Shah Blogspot -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -