Screen Shot 2017-07-13 at 3.43.34 PM

  • System calls provide an interface between user programs and operating system.
  • It is a programmatic way in which a computer program requests a service from the kernel of the operating system.

Here is a short video i made which will help you understand better.

Let us first understand the 2 modes in which a program executes.


  • User mode
  • Kernel mode

When a program is executing in user mode, it is not in privileged mode. So whenever it needs any hardware resource like RAM or printer, it needs to make a call to the kernel and this is known as SYSTEM CALL.

When a program is executing in kernel mode, it is executing in privileged mode. So it can access any hardware resource. So when a program needs to access any resource while it is running in user mode it makes a System Call to the kernel then a context switch occurs which takes the program from user mode to kernel mode. After the resource is accessed one more context switch occurs which takes back the program’s execution to user mode.

Now you may wonder why aren’t all programs occurring in kernel mode so we can skip the context switching. This is because if a program crashes in kernel mode entire system will be halted. So most programs are executed in user mode because if it crashes there, entire system won’t be affected.

Now let us take an example.

Screen Shot 2017-07-13 at 4.09.42 PM


If we want to write a program to copy the content of one file into another then, first of all this program will need the names of these files. User will give these names by either typing them in the console or selecting them by using GUI. So our program will need to make system calls to the kernel to enable it to access the input and output devices.

Also our program will need to display certain message if the program is successfully completed or even if it stops and is aborted. All these tasks require System calls.


A) Process Control

Processes need to be controlled as in a running process must be able to halt its execution either normally or abnormally.Also one process may need to run some other process to complete its own execution. So all these system calls come under this category.

  • end, abort
  • load, execute
  • create process, terminate process
  • get process attributes, set process attributes
  • wait for time, wait event, signal event
  • allocate and free memory

B) File Management

System calls which deal with operations related to files fall under this type.

  • create file, delete file
  • open, close
  • read, write, reposition
  • get file attributes, set file attributes

C) Device Management

A process may need several resources for its execution. So system calls used for asking permission from the kernel to use those resources are included in this type.

  • request device, release device
  • read, write, reposition
  • get device attributes, set device attributes
  • logically attach or detach devices

D) Information Maintenance

We need to keep all the information up to date so these system calls help us to do that.

  • get time or date, set time or date
  • get system data, set system data
  • get process, file, or device attributes
  • set process, file, or device attributes

E) Communication

Processes need to communicate with each other for many reasons like if they need certain resource which is held by any other process. These system calls assist in doing so.

  • create, delete communication connection
  • send, receive messages
  • transfer status information
  • attach or detach remote devices