What are system calls? They are nothing, but interrupt generated by hardware according to an instruction so that operating system is able to gain the control of processor. So, they are not a set of instructions to do a specific function in hardware, instead they give a temporary break to ongoing set of instructions to perform an urgent task.

Now let us see how it operates. It follows through a sequence of steps. When a program executes a system call instruction, the following steps take place. Let me tell you, 'ia' is instruction address register and 'psw' is program status word. ‘rti’ is return from interrupt.


  1. A system call is executed.
  2. Hardware saves the current address register ia and current program status word psw to two temporary variables, iia and ipsw.
  3. The value of psw register is initialized to zero by hardware.
  4. New instruction is uploaded in the hardware and address register of the new program (the instruction causing the interrupt) is loaded.
  5. New instruction will be executed which begins at the system call interrupt handler.
  6. When execution is completed rti value is returned and previous ia and psw are restored again.
  7. Execution continues with the present values of ia and psw.

So, it’s somewhat similar to a procedure call with a few differences. Similar to a procedure call, when an interrupt occurs, previous values are stored in temporary registers and flow of control is given to the new set of instructions. When those steps are completed, control returns back to the previous values, where the instruction was stopped by the interrupt. After restoring the intermediate values stored in temporary registers, the next steps will be followed as per algorithm and resultant values are returned. But only exceptions are change of processor mode from user to system and instead of an address, system call is identified by an integer number. The argument passed as integer is used as index by OS.

How system calls are made?

System call machine language instructions are used for initiating a system call. A simple read system call is given below.

void open (char *fname){
         load ReadSysCal Num, n3
        move fname,n4

System call interface

System calls are a set of instructions provided by OS and its description is given by system call interface. Normally, a set of system calls are grouped together under a single system call interface.
System call interfaces are broadly grouped under three categories

  1. File and Input/Output System calls
  2. Process Management System calls
  3. Inter process communication System calls

Let me give a brief idea of these three system calls.

File and Input/Output system calls (I/O System call)

The different file operations include open a file, create a new file, read or write a piece of information in the form of bytes, to search a data and a file close operation. For each operation stated above, operating system has provided separate system calls. It may be needed to interrupt a specific instruction before performing any of the above system calls.
Eg: Open, Creat, Read, Close

Process Management system calls

It deals with manipulating process calls. It includes creation of a new process, to create its duplicate if needed, to terminate or wait for another process to exit.
Eg: CreateProcess, Fork, wait, Exit

Inter process Communication system calls

They are interrupts or system calls for communication between processes. Sometimes, a data may be needed to continue an on-going process. If so, an interrupt is given, the corresponding data fetched and again system call returns back to continue the following steps or instructions at the system call. Such communications are conveyed through messages and often it’s needed to create queues, as such messages to a particular register flow in hundreds. So, a message queue is created first and messages are popped into that queue and normally served in FIFO basis.

So, common IPC system calls include CreateMSG, SendMSG, RecMSG and DestroyMSG.

Through this article I have given a basic idea on system calls, how they function and how they are categorized, in a simplified version. Hoping it will be helpful for IT students while preparing for their exams. 

Like it on Facebook, +1 on Google, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet