System Call in Operating System

System call facilitates user programs running in the user mode to request services from the kernel mode of the operating system. The program in user mode doesn’t have direct access to system memory and hardware. While the program running in kernel mode has direct access to the system hardware and memory.

System Call in Operating System

  1. What is System Call?
  2. Working
  3. Services Provided
  4. Types

What is a System Call?

System calls are the calls (functions) that are required to invoke the services provided by the operating system. These calls provide an interface between the user program and the operating system. We call this interface as Application Program Interface.

Example:

Consider that there is a user program that will read the content of one file and will copy it into another file. Here the first information that the system requires is the name of two files the first file from where the data has to be read (input file) and the second file where the data has to be copied (output file).

Depending on the different types of operating systems a sequence of system calls will be required.

A sequence of system calls in an interactive system will be like this:

  1. Prompt a message on the screen asking the user to provide the name of the input and output file.
  2. Read from the characters from the keyboard provided by the user that defines the name of the input file and output file.
  3. The system will open the input file.
  4. Read the data from the input file.
  5. Creates and outputs files.
  6. Copy the data into the output file.

So, this sequence of system calls is required to accomplish the task.

Working

System call working

  1. Initially, a processor executes a user program in the user mode.
  2. Then if the program needs the services of the operating system the processor is interrupted by the system call.
  3. A system call is always prioritized over the other executions and the system call is then executed in the kernel mode.
  4. Once the system call is executed completely the control goes back to the user mode.
  5. And the execution of the program resumes back in the user mode.

Services Provided

  • System calls are helpful in managing the main memory of the computer.
  • It manages the file system of the computer and thereby controls the access to files and directories of the system.
  • Creates and controls the new processes.
  • Control I/O devices
  • System calls are even required when a system sends and receives packets over the network connection.

Types of System Call

Process control

The process control system call is used to create and manage the processes in the operating system. Following are the function of the process control system call:

  • It creates and terminates the process whenever required.
  • It also controls the termination of a running program normally (end) or abnormally (abort).
  • While executing a program the process control system call controls the loading and execution of another program.
  • It determines and resets the attributes of a process as the process switches between the execution.
  • It helps in allocating memory to the process and even frees the memory when the process terminates.
  • It controls the waiting time that is required to finish a process execution.
  • The process control calls wait events that will signal the execution completion of a process.

File management

The file management system call controls the file and directory system of the computer.

  • This call creates and deletes the files of the system.
  • It creates a new file and even controls its deletion.
  • This call is required to open and close the file.
  • It is also used to perform read and write operations on the file.
  • This call is even required to determine and reset the attribute of the file.

Device management

The device management system call is required to control and manage the devices attached to the computer system.

  • This call controls the requests from the process for the several resources (devices) of the system.
  • It controls the read, writes operations on the devices.
  • It provides the resources to process for execution and even releases the devices after completion of the process.

Information maintenance

The information maintenance system call maintains the information of the computer such as system time, date, etc.

  • These calls are used to get the system information such as the version of the operation system, configuration of the system.
  • To get the information about all the processes of the operating system.
  • To get information about all the files on the system.
  • To get information about all the devices attached to the system.

Communications

A communication call is required to connect your computer over the network.

  • It creates and deletes the communication connection over the network.
  • This call is even required to send and receive messages over the network.
  • Transfer status information of the connected devices over the network.
  • This call is even required to attach or detach the remote devices connected to your computer over the network.

Thus we have learned about the system calls in the operating system, it’s working, and also their types.

Leave a Reply

Your email address will not be published. Required fields are marked *