System call in Operating system | Types with Example

Hello, friends in this Article I am gone a explain to you what is system call in OS and their types with an example so let’s get started.

System call in Operating system

Why we need to use System call?

Here the first question arises that why we need to use system call so the reason is as you know the operating system is used to work in two different mode user mode and kernel mode so if the operating system wants to move from one mode to other modes at that time we need to use a system call.

If you don’t know what is user mode and kernel mode and what is the difference between them and what is the use of that you can read that article on a dual-mode operatios.

Let’s back to the topic I explain you with the simple example generally the user which means us we used to work in user mode but suppose we need to access any file from storage or hard disk.

At that time we can’t access that data directly from user mode then we need to switch to kernel mode to access that data because in the operating system if you need to access any data that word can only do in kernel mode so I hope you understand.


Example of why we need to use system call?

Let’s understand with one basic and simple example suppose I write one code to do the addition of two numbers like 2+2 so this process can be done by the processor but I want to display that answer to monitor for that I need to switch to kernel mode because that can only be done in kernel mode.

So as we know we switch to kernel mode for a different reason or we can say to execute different functions so for that, there are some types of system call on OS so let’s see what are the types of system call.

Types of system call in OS


        1.File Related

·        2.device related

·        3.Information

·        4.process control

·        5.Communication


So Let’s Understand all this terms with example


File Related System call

This term file-related system call occurs when Suppose you are writing code for open one document from hard disk make changes inside that document and save again so it’s call file-related system call basically if you want to open, close, read, write or create any file in hard disk or computer storage at that time you are dealing with file related system call.

When we can use File related system call?

We can use this when we need to perform operations like this open(), close(), read(), write() and create()


Device Related System call

This term Device Related system call is as like the name is connected with device let’s take one basic example to suppose you want to print something at that time you need to access printer for that operating system used device-related system call let’s understand the full process.

Suppose you need to print your one photo at this moment you are in user mode but when you click on the print button the CPU gives a signal to the operating system to start the process to print at this moment operating system calls the function Device related system call that’s it I hope you understand.

And not just printer when you access any of your device which connected to your Pc like Printer, speaker, scanner at that time this term Device related system call occurs.

When we can use Device related system call?

We can use this term at that time when we need to use this functions in are code like read(), Write(), Reposition(), ioctl() and fnctl() or simply I can say when we need to access the accessory of computer


Information Related system call

We can use information related system call at that time when we need metadata which means if we want some related data of main data then we can use information related system call.

Let’s take a simple example to suppose I have one audio file in hard disk if I want to know what is the size of that file or what is the modification date and all related data at that time we can use information related system call in Operating system.

When we use Information related system call?

If I want to fetch the size of the file, name of the file, the permission of file extension of file or attribute at that time we can use it.


Process Control System call

Majorly we are using this process control system call. We use this when we need to execute code or operation or suppose I need to execute any program or I need to process or if I want to abort recompile or any operations at that time we are using this process control system call.

Generally, we are using a multi-process control system which means we are running more than one process at a time for that we are using Fork process control system let’s understand.

Fork process control system call

In fork process when we do more than one process at that time fork process comes into the picture fork process is work like it creates parent and child process which means parent process do their work and child do their work so not the work is executing at a time so it is very useful.

When we use process control system call?

We use process control system call we are performing this operations load, execute, abort, fork, wait, signal, allocated etc.


Communication system call

Communication system call generally are used when we are running two processes at a time and that both processes communicate with each other at that time communication system call are used.

This process is used when two processes share their memory and process details and all.

When we use the Communication system call?


We are using this communication system call when we create or delete the connection between two processes or pipe(), shinget() etc.

That’s it so I hope you understand the full topic of a system call in the operating system if you have any query you can feel free to ask me in the comment section and if you like the article do not forget to share with your friends and for the daily update do email subscription to get a direct notification to your mailbox thank you for reading the article.

Related Posts

Post a comment


www.rocknews.mI said…
๐Ÿ’”Thank you So much ๐Ÿ’‹