The system calls is a mechanism that allows the user program to invoke the kernel that let the user program to interact with the operating system. The number of system calls depends upon the kind of operating system you are using.
In this section further, we will be discussing the type of system calls that are used by the user program to interact with the operating system.
Types of System Calls
- Process control
- File Manipulation
- Device Manipulation
- Information Maintenance
There are several system calls that are required to control the processes in the operating system. The first required system call creates process, once the process is created then it must be loaded to the main memory for execution.
Once the process is created it will require some time to finish its execution, the amount of time it needs to wait is wait time. Or the process must be waiting for a certain event to occur i.e. wait event. The time at which the event would occur must be signalled with the signal event.
The most used system calls for file manipulation are creating the file and deleting the file. For file manipulation, the system calls either use the name of the file or it may use any of the file’s attribute. The created file also needs to be opened, read, write or reposition and after the usage, the file needs to be closed.
The same set of operations can also be used for directories, in case we are using directory structures for organizing files. File manipulation system calls such as get file attribute, set file attribute and are used to determine or reset the values of attributes of files or directories. The attributes to be determined or rest are file name, its type, accounting information, protection code etc.
A process requires to held several resources for its execution. The resource can be physical devices such as disk and drives or virtual devices such as files. For exclusive use, the process must first request for the device and after the task is completed it must release the resource. This is similar to open and close system call we use in file management.
Some information maintenance system calls are used for transferring information between the user program and the operating system. Some information maintenance system calls return system information such as the amount of free memory, your system configuration, number of current users of the system, etc.
The information maintenance system all dump memory stores the information of application or system before it gets crashed. So, the dump memory system call helps the programmers or developers in debugging the program.
Communication System Calls
In our previous content, we have discussed two types of interprocess communication i.e., message-passing model and shared memory model. In the message-passing model, the two processes communicate with each other to exchange the information. The communicating processes may be on the same system or on two different systems connected by the communication network.
To start communication, the connection must be opened between the two communicating processes and the process that wants to send the message to the other process must know the name of the latter process. For that, it can use two elements such as the computer name host_id to which the latter process belongs and the name of the process i.e., process_id.
The system calls used to get the host_id and process_id get hostid and get processid. Further, these identifiers are passed to the open connection and close connection system calls. The recipient process permits the connection with the accept connection system call. The information is exchange using the read message and writes the message system call. Finally, the connection is terminated with a close connection system call.
In the shared-memory model, to gain access to region held by other processes the client process uses shared memory create and shared memory attach system call. Usually, the operating system doesn’t allow a process to access the resources held by other process but the shared memory model removes this restriction.
Protection System Calls
Protection is a technique that controls access to system resources. As of today’s scenario, the computers i.e. form servers to PDA all over the world are connected using networking and internet need to be concerned about protection.
The system calls providing protection to the system resources are get permission and set permission thereby controlling the access to system resources such as files and disk. Further, the allow user and deny user system call only let the authenticated user access the system resources.
With all these system calls the user program can interact with the operating system.