System Call
A system call is a mechanism that allows a program to request a service from the operating system’s kernel.
It is the interface between user applications and the core of the operating system.
Why system calls exist
Applications do not have direct access to hardware or critical system resources for security and stability reasons.
Instead of accessing hardware directly, programs ask the kernel to perform operations for them.
This request is called a system call.
How it works
- A program needs to perform an operation (for example, open a file).
- It makes a system call.
- The CPU switches from user mode to kernel mode.
- The kernel performs the requested task.
- The result is returned to the program.
This controlled transition ensures system protection.
User Mode vs Kernel Mode
- User Mode – restricted mode where applications run
- Kernel Mode – privileged mode with full access to hardware
System calls are the safe bridge between these two modes.
Common types of system calls
1. File Management
- Open a file
- Read or write data
- Close a file
2.Process Control
- Create a new process
- Terminate a process
- Wait for a process
3. Memory Management
- Allocate memory
- Free memory
4. Device Management
- Communicate with hardware devices
Examples
When you:
- Save a document → system call writes data to storage
- Open a program → system call loads it into memory
- Send data over the internet → system call uses network resources
Most actions in an operating system involve system calls.
Performance impact
System calls are slower than normal function calls because they require:
- Mode switching
- Security checks
- Context switching
However, they are essential for system stability.
Why it is important
- Provides secure access to hardware
- Protects the system from unsafe operations
- Enables communication between applications and the OS
- Maintains system control and stability
Without system calls, applications could crash or damage the system.
A simple example
Imagine a restaurant:
Customers (applications) cannot enter the kitchen (kernel).
They place an order (system call), and the kitchen prepares the meal and brings it back.
Related terms
- What is Kernel?
- What is Process?
- What is Interrupt?
Source
Information simplified from the Wikipedia article “System call”.