LearnYourBasics

Spread your knowledge

System Call in OS

System Call in OS are the programmatic way of a computer program that  requests specific services from the operating system’s kernel, acting as the bridge between user applications and protected system resources. 

They allow programs running in user mode to access hardware, manage processes, or handle files without direct privileged access, which could cause instability or security issues. When invoked, a system call triggers a mode switch to kernel mode via an interrupt or trap, where the OS executes the request and returns control (often with results or errors) back to the user program.

 This interface ensures safe, standardized operations, like reading a file or creating a process, preventing apps from bypassing OS controls. Without system calls, software would need custom hardware drivers, leading to chaos in multi-program environments.

NOTE * Mode switch and Context Switching are two different concepts, though mode switch can be called a subset of context switch *

There are two modes of operations in which a program can execute . One is the user mode and the other is the kernel mode. User mode and kernel mode are two execution environments in an operating system (OS) that separate user applications from the core OS functions for security and stability. User mode is a restricted environment for applications, with limited access to system resources, while kernel mode is a privileged mode with full access to hardware and memory for the operating system kernel to perform critical tasks like memory management, process scheduling, and direct hardware interaction.

User Mode

1.  Function: Runs applications and non-critical processes.
2. Access: Has limited access to system resources and cannot directly access hardware or kernel memory.
3. Security: Acts as a protective barrier, isolating applications. If a user-mode program crashes, it typically only affects that single application, not the entire system.
4. Interaction: User applications must use system calls to request services from the kernel, such as reading a file or sending data over the network.

Kernel Mode

1. Function: Runs the core of the operating system, known as the kernel.
2. Access: Has unrestricted access to all system resources, including all memory and hardware.
3. Security: Because of its privileged access, errors in kernel mode can cause the entire system to become unstable and crash.
4. Interaction: The kernel handles all requests made by user-mode applications, performs crucial tasks, and manages hardware directly.

Scroll to Top