To understand system calls first we must understand the difference between kernel mode and user mode of a CPU. Almost every operating system supports these two modes.
When a CPU is in kernel mode, the code that is being executed has access to any memory address and any hardware parts. So kernel mode is a very privileged and a powerful mode. If a program is crashed in kernel mode, the entire system will be halted.
When a CPU is in user mode, the code doesn’t have direct access to memory and hardware units. If any program crashes in user mode, only that particular program is halted. This means the system will remain in a safe state even if a program in user mode is crashed. So, most programs in an OS run in user mode.
A system call is the programmatic way in which a computer program requests a service from the kernel of the operating system it is operated on. A system call is a way that the programs interact with the operating system. A computer makes a system call when it raises a request to the operating system’s kernel. A system call provides the services of a operating system(OS) to the user programs via Application Program Interface(API). This provides an interface between the process and operating system to allow user-level processes to request services of the operating system. System calls are only entry points into the kernel mode. Any program that needs resources must use system calls.
System Call Services
- Process creation and management
- Main memory management
- File Access, Directory and File system management
- Device handling(I/O)
- Networking, etc.
Types of System Calls
- Process control: abort, end, create, terminate, allocate and free memory.
- File management: create, delete, open, close, read file etc.
- Device management.
- Information maintenance.
These system calls deal with the process creation, process termination etc.
These are responsible for manipulating a file such as creating a file, reading a file, writing into a file etc.
These are responsible for manipulating a device such as reading from device buffers, writing into device buffers etc.
They handle information and also transfer of information between the operating system and the user program.
These are useful for inter-process communication and also deal with creating and deleting a communication connection.
Examples of Windows and Linux System Calls
Below table contains the examples of some of the system calls.
|Types of System Calls||Windows||Linux|
References: Operating System Concepts
What are the types of system calls?
Types of System Calls. There are 5 different categories of system calls: process control, file manipulation, device manipulation, information maintenance and communication.
What is system call in operating system with example?
On Unix, Unix-like and other POSIX-compliant operating systems, popular system calls are open , read , write , close , wait , exec , fork , exit , and kill . Many modern operating systems have hundreds of system calls.
What is the purpose of system calls in operating system?
A computer makes a system call when it raises a request to the operating system’s kernel. A system call provides the services of a operating system(OS) to the user programs via Application Program Interface(API). This provides an interface between the process and operating system to allow user-level processes to request services of the operating system. System calls are only entry points into the kernel mode.