What is System Call in Operating System?
ANSWER
A system call is a mechanism that provides the interface between a process
and the operating system. It is a programmatic method in which a computer
program requests a service from the kernel of the OS.
Example of System Call
For example if we need to write a program code to read data from one file,
copy that data into another file. The first information that the program requires
is the name of the two files, the input and output files.
In an interactive system, this type of program execution requires some system
calls by OS.
First call is to write a prompting message on the screen
Second, to read from the keyboard, the characters which define the two
files.
Why do you need System Calls in OS?
ANSWER
Following are situations which need system calls in OS:
Reading and writing from files demand system calls.
If a file system wants to create or delete files, system calls are required.
System calls are used for the creation and management of new
processes.
Network connections need system calls for sending and receiving
packets.
Access to hardware devices like scanner, printer, need a system call.
Types of System calls
Here are the five types of System Calls in OS:
Process Control
File Management
Device Management
Information Maintenance
Communications
Process Control
This system calls perform the task of process creation, process termination,
etc.
Functions:
End and Abort
Load and Execute
Create Process and Terminate Process
File Management
File management system calls handle file manipulation jobs like creating a file,
reading, and writing, etc.
Functions:
Create a file
Delete file
Open and close file
Device Management
Device management does the job of device manipulation like reading from
device buffers, writing into device buffers, etc.
Functions:
Request and release device
Logically attach/ detach devices
Get and Set device attributes
Information Maintenance
It handles information and its transfer between the OS and the user program.
Functions:
Get or set time and date
Get process and device attributes
Communication:
These types of system calls are specially used for interprocess
communications.
Functions:
Create, delete communications connections
Send, receive message