Common System Calls Relating To Files

Geek Square gets many inquiries for data recovery in the Toronto area. While explaining the data loss issues, we have to refer to system calls. In this article, we will be discussing the system calls for a wider audience.

In computer systems, the files store information and let it be retrieved later. Different system calls enable storage and retrieval. In the following, we are going to discuss the most common system calls relating to files.

Common System Calls


This system call creates a file with no data. 'Create' system is an announcement that the file is coming and set some of the attributes.


When the file is no longer needed, the system deletes it to free up disk space. There is always a system call for this purpose. Besides, some operating systems automatically delete any files that are not in use for the last N days.


Before using a file, a process must open it. The purpose of the OPEN system call is to allow the system to fetch the attributes and list of disk addresses into the main memory for rapid access on subsequent calls.


When a system releases all the accesses, the attributes and disk addresses are no longer needed. That is why the file should be closed to free up internal tablespace. Many systems encourage this by imposing a maximum number of open files on processes.


With Read system call, the system reads data from a file in computer memory. Usually, the bytes come from the current position. The caller must specify how much data is needed and must also provide a buffer to put it in.


Write system call writes data to the file, again usually at the current position. If the current position is the end of the file, the file's size also increases. If the new position is in the middle of the file, existing data are overwritten and lost forever.


This call is a restricted form of WRITE. It can only add data to the end of the file. System that provides a minimal set of system calls do not generally have APPEND, but many systems offer multiple ways of doing the same thing, and these systems sometimes have APPEND.

Top Data Science Consultants

Helping finance, insurance and banking industry.