Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What is a system call?
A system call provides an interface between a user program and the operating system. It is a programmatic way in which a computer program requests a service from the kernel of the operating system. When a user wants to give an instruction to the OS, it does so through system calls.
Execution Modes
A program executes in two modes −
User mode − Cannot access hardware resources directly; can only perform user operations with restricted privileges.
Kernel mode − Can access all hardware resources like RAM, disk drives, and printers with full system privileges.
The processor switches between these two modes depending on what type of code is running. A process in user mode cannot access the virtual address space reserved for the operating system. The mode bit is set to 1 in user mode and 0 in kernel mode.
Mode Transition Process
The transition from user mode to kernel mode occurs when −
The application requests help from the operating system
An interrupt occurs
A system call is made
When a program needs hardware resources, it makes a call to the kernel through system calls. The program switches to kernel mode, performs the required hardware operations, and then returns to user mode to continue execution.
Why System Calls Are Necessary
Due to security reasons, user applications are not given direct access to hardware resources. When they need to perform I/O operations or require memory allocation, they must request these services from the OS. This controlled access ensures system stability and prevents unauthorized access to critical system resources.
Conclusion
System calls serve as the essential bridge between user programs and the operating system kernel. They provide a secure and controlled mechanism for applications to access hardware resources while maintaining system integrity and security through the user-kernel mode separation.
