What are the different system calls in the operating system?

Operating SystemHardwareSoftware & Coding

The different system calls are as follows −

  • System calls for Process management

  • System calls for File management

  • System calls for Directory management

Let us understand them one by one.

System calls for Process management

A system is used to create a new process or a duplicate process called a fork. The duplicate process consists of all data in the file description and registers common. The original process is also called the parent process and the duplicate is called the child process.

The fork call returns a value, which is zero in the child and equal to the child’s PID (Process Identifier) in the parent. The system calls like exit would request the services for terminating a process. Loading of programs or changing of the original image with duplicates needs execution of exec. Pid would help to distinguish between child and parent processes.

For example, process management system calls in Linux.

  • fork − For creating a duplicate process from the parent process.

  • wait − Process is supposed to wait for other processes to complete their work.

  • exec − loads the selected program into the memory.

  • exit − terminates the process.

System calls for File management

A file is open using a system call open. The mode in which the file is supposed to be open is specified using the parameter.

Parameters also consist of the names of the file to open or a new one to be created. The files are closed using the close systems. Associated with each file is a pointer that indicates the current position in the file.

When reading or writing sequentially, points to the next byte to be read or written. The Lseek call changes the value of the position pointer, so that subsequent calls to read or write can begin anywhere in the file.

Lseek has three parameters which are as follows −

  • File descriptor for the file

  • File position

  • File position is relative to the beginning of the file, the current position, or the end of the file.

For example − systems calls for file management

  • open − For opening the file for reading, writing.

  • close − To close the opened file.

  • read − For reading the data from the file into the buffer.

  • write − For writing the data from the buffer into file.

System calls for Directory management

mkdir is a system call that creates empty directories, whereas rmdir removes empty directories.

The link allows the same file to appear under two or more names, often in different directories allowing several members of the same programming team to share a common file, with each of them having the file appear in his own directory, possibly under different names.

By executing the mount system call, the USB file system can be attached to the root file system. The mount call makes it possible to integrate removable media into a single integrated file hierarchy, without having to worry about which device a file is on.

Published on 29-Nov-2021 09:44:46