Open In App

System Call

Last Updated : 02 Dec, 2025
Comments
Improve
Suggest changes
280 Likes
Like
Report

User programs cannot directly access hardware or critical OS resources because it would make the system unstable and insecure. To maintain safety, the operating system provides system calls — controlled interfaces that allow user programs to request services from the kernel. These calls act as a gateway between user mode and kernel mode. System Calls are,

  • A way for programs to interact with the operating system.
  • Provide the services of the operating system to the user programs.
  • Only entry points into the kernel are executed in kernel mode.
introduction_to_system_call
System Call

Example:

  • Opening a file in C (fopen) internally uses system calls like open().
  • Running a program in Linux uses fork() and exec() system calls.
  • Printing on screen uses the write() system call.

How do System Calls Work?

A system call is a controlled entry point that allows a user program to request a service from the operating system. Here's how it works:

  • The user program executes a system call instruction (e.g., using syscall or int 0x80).
  • The CPU switches from user mode → kernel mode for safe execution.
  • The kernel identifies the system call number and performs the requested operation (file access, process creation, memory allocation, etc.).
  • After completing the task, the kernel switches back to user mode.
  • The result (success/failure/data) is returned to the program.
  • Without system calls, every program would need its own way to access hardware, leading to inconsistent and insecure systems.

System calls are slower than normal functions because switching from user mode to kernel mode requires context switching, which takes time.

Types of System Calls

Services provided by an OS are typically related to any kind of operation that a user program can perform like creation, termination, forking, moving, communication, etc. Similar types of operations are grouped into one single system call category. System calls are classified into the following categories:

frame_11
Types of system call

Read more about - Different Types of System Calls in OS

  • File System: Used to create, open, read, write, and manage files and directories.
  • Process Control: Used to create, execute, synchronize, and terminate processes.
  • Memory Management: Used to allocate, deallocate, and manage memory for processes.
  • Interprocess Communication (IPC): Used for data exchange and communication between different processes.
  • Device Management: Used to request and release devices, and to perform read/write operations on them.
Suggested Quiz
5 Questions

Which of the following causes the CPU to switch from user mode to kernel mode?

  • A

    Interrupt

  • B

    System Call

  • C

    Function Call

  • D

    Compiler Optimization

Explanation:

System CallIt safely transfers control to the kernel for OS services.

Why are system calls slower than normal function calls?

  • A

    Use of cache memory

  • B

    Use of recursion

  • C

    Mode switching overhead

  • D

    High-level language execution

Explanation:

Mode switching overhead — Switching between user mode and kernel mode takes extra time.

Which system call is used to create a new process in Linux?

  • A

    exec()

  • B

    open()

  • C

    fork()

  • D

    read()

Explanation:

fork() — It creates a child process from the parent process.

Which category of system calls is used for communication between processes?

  • A

    File System

  • B

    Memory Management

  • C

    Process Control

  • D

    Interprocess Communication

Explanation:

IPC allows processes to exchange data.

Which system call is internally used when printing output to the screen?

  • A

    write()

  • B

    malloc()

  • C

    close()

  • D

    wait()

Explanation:

It sends data to output devices like the screen.

Quiz Completed Successfully
Your Score :   2/5
Accuracy :  0%
Login to View Explanation
1/5 1/5 < Previous Next >

Article Tags :

Explore