View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All

System Calls in Operating System (OS): What is, Types [with examples]

By Pavan Vadapalli

Updated on Mar 28, 2025 | 10 min read | 5.8k views

Share:

What is System Calls in Operating System (OS)

System calls are an integral feature of an operating system (OS) that enable user applications to request services from the kernel of the OS. These are predefined functions that the operating system can directly activate when using a high-level language. 

System calls are the sole entry points into the kernel system, and any applications seeking resources must use them. This blog will cover what system calls are, their kinds, and examples of how they function. 

Understanding System Calls: What Are They?

A system call is a programming technique that enables a computer program to ask the software program on which it is running for a service. It is a means of interaction between programs and the operating system’s kernel. 

User-level programs can request operating system operations using a system call, which serves as the software program’s gateway between the process and its components. The kernel system can only be accessed using system calls. 

Any program that needs resources must use system calls. System calls provide a virtual interface between a process and the operating system. They provide user programs with access to operating system features Through application program interfaces (APIs). 

A wide range of operations is performed via system calls, including creating and managing processes, controlling main memory, file access, directory and file system administration, information upkeep, communication, and hardware device access.

System calls are commonly implemented in C, combined with assembly code. However, system calls can be written in any programing language that can interact with the operating system’s kernel. 

A system call is a function a user software employs to ask the operating system for a certain service. User programmers can connect with the operating system to request its services via the interface established by a system call. Assembly language instructions are often used as system calls and are also covered in the manuals used by assembly-level developers.

The upGrad Full Stack Software Development Bootcamp is a beginner-friendly online program offering a self-paced format and blended learning. The bootcamp covers various topics, including HTML, CSS, JavaScript, AJAX, and more. It will help individuals upskill in software development and gain knowledge in related areas like operating systems.

Here’s an example of how to use open() and read() system calls in C++ to read data from a file:

#include <iostream>
#include <fcntl.h>
#include <unistd.h>
int main() {
  int fileDescriptor = open("example.txt", O_RDONLY);
  if (fileDescriptor == -1) {
    std::cerr << "Error opening file" << std::endl;
    return 1;
  }
  char dataBuffer[2048];
  ssize_t bytesRead = read(fileDescriptor, dataBuffer, sizeof(dataBuffer));
  if (bytesRead == -1) {
    std::cerr << "Error reading file" << std::endl;
    return 1;
  }
  std::cout << "Read " << bytesRead << " bytes: " << dataBuffer << std::endl;
  close(fileDescriptor);
  return 0;
}

This program opens a file named example.txt using open() system call with O_RDONLY flag to indicate that it should be opened for reading only. It then reads data from the file using a read() system call and stores it in a buffer. Finally, it prints out the number of bytes read and the contents of the buffer. The file descriptor returned by open() is closed using the close() system call when it is no longer needed.

Check out our free technology courses to get an edge over the competition.

Types of System Calls

System calls can be written in assembly code or high-level languages like C or Pascal. They are often found as assembly language instructions and detailed in guides that programmers at the assembly level utilise. 

There are several types of system call in an operating system:

Process Control: These system functionalities are used to create and oversee processes. Examples include the functions fork(), exec(), wait(), and exit().

Device Management: This system call controls hardware components such as network interfaces, printers, and scanners. Examples are the functions ioctl(), read(), write(), and open().

Inter-process communication (IPC): These system calls let processes executing on the same or other systems interact. Examples are socket(), bind(), listen(), accept(), connect(), sendto(), and recvfrom().

File management: One can create, open, read, write, close, and destroy files using these system functions. Examples include the functions open(), read(), write(), close(), and unlink().

Information management: Between the operating system and computer programs, these system calls to manage and send data. Examples are time(), getpid(), getuid(), and getgid().

Now we will discuss a few types to understand what is a system call in depth.

Process Control System Calls

Process control is a kind of system call used to manage processes. The creation, loading, aborting, terminating, executing, processing, and terminating of processes are all handled by process control system calls. 

A fork, sometimes called a duplicate or new process, is created using the process control system function. The duplicate process has its file descriptor table, signal handlers, and other process-specific characteristics, but it shares the same memory space as the original.

System calls to the process control system do process generation, management, and coordination. 

Here are some examples of calls to process control systems:

  • Creating a new process
  • The act of ending a process
  • Launching a process
  • Giving up on a process
  • The act of ending a process
  • Implementing a procedure
  • Carrying out a process

An operating system uses these system calls to manage and direct processes. New processes can be initiated and managed via system calls. The shell programs use system calls to perform tasks related to process coordination.

System calls for process control vary between Windows and Unix regarding syntax and usefulness. 

Here are a few differences:

Between Windows and Unix, system calls for process control have different syntaxes. For instance, the CreateProcess() system call is used in Windows to start a new process, but the fork() system call is used in Unix.

Between Windows and Unix, the system calls for process control and operates differently. For instance, wait() is used in Unix to wait for a child process to complete, but WaitForDingleObject() is used in Windows to wait for a process to finish.

Despite these variations, Windows and Unix provide functionality for process management systems that let users design, control, and organise processes.

File Management System Calls

File management is one of the types of system calls in an operating system that deal with file manipulation operations, including generating, reading, and writing files. These system calls handle directories and files. The file management system calls open(), read(), write(), close(), create(), delete(), and others are examples. To access a file on a file system, use the system function open()

It gives the process a handle to refer to and the file resources. While the system call write() opens the file in writing mode, the system function read() opens it in reading mode. The system method close() is used to close the file. While the system function delete() removes an existing file, the system function creates () a new one. Five system calls—create, open, fcntl, dup, and pipe—are used to create file descriptors.

Memory Management System Calls

Memory management system calls are used in Unix and Unix-like operating systems to control the amount of memory allocated to a process’s data segment. The two most common system calls for this purpose are brk and sbrk. These routines are often called from higher-level memory management library operations like malloc. 

The brk and sbrk commands dynamically alter the space given for the calling process’s data segment by resetting the process’s program break, which sets the maximum space that can be allocated. 

The address of the program break is the first point beyond the current end of the data segment. Mmap is another memory management system function that maps files into memory and is utilised for memory-mapped file I/O. 

The shmdt system function removes a memory object from the address space of a process, while shmctl performs additional functions, such as locking the item inside the main memory to prevent it from being paged off to the disc. Memory allocation methods and language statements like malloc/free and new/delete are not system calls. However, they can result in system calls with insufficient space in the committed pages.

Check Out upGrad’s Software Development Courses to upskill yourself.

Communication System Calls

In computer programing, communication system calls are a collection of procedures or methods an operating system gives to facilitate inter-process communication (IPC) between distinct processes or threads running on a computer. These system calls offer an interface for processes to communicate data, synchronise their actions, and coordinate their execution.

Here are a few instances of typical calls made on communication systems:

An essential method of network communication is the use of sockets. Protocols like TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) make it possible for the software to create connections, transmit and receive data through networks, and more.

Communication between related tasks is facilitated through pipes. Through one-way communication made possible by them, one activity’s output might become another activity’s input. Pipes are often used to communicate between parent and child processes.

Message queues enable communication by sending and reading messages to and from a shared queue. Multiple operations can access each message in the queue in a specified sequence, and each message has a distinct identity.

Programs can share a slice of memory known as shared memory. Multiple programs can read from and write to this shared memory area, enabling quick and effective communication. Synchronisation methods like semaphores or mutexes are often used to synchronise access to shared memory. 

Signals enable asynchronous communication between processes. One process can send signals to inform another process of an event, such as the completion of a procedure or the presence of an error.

Thanks to the RPC communication mechanism, a process can carry out a method or function in a distant process as if it were a local call. It offers a simple interface for initiating processes on distant systems and abstracts communication complexity.

Protection System Calls

Protection system calls vary from standard system calls in that they are used to access privileged activities that are not accessible to typical user applications. The operating system uses system calls to regulate access to system resources, and these functions have higher power than regular subroutines. 

Protection system calls are used to protect the system resources by regulating access to them by obtaining and setting permission calls. System calls are intercepted at the kernel level and verified based on rules stored in a database. Regular system calls can be used for process control, file management, device administration, information maintenance, and communication.

System calls offer protection in operating systems in two major ways. First, the operating system must examine the right of a process to seek a privileged command, which requires various checks to guarantee that the process has the proper permissions. 

Second, system calls are the sole means for user-level programs to request operating system services, and they offer well-defined, secure implementations for actions that need access to hardware devices or other privileged operations. Additionally, certain system calls are expressly built for protection, such as SetFileSecurity and other security system functions that regulate access to system resources.

 

Examples of System Calls in Different Operating Systems

Different operating systems have different sets of system calls. Here is a table showing system call examples in different operating systems:

Operating System Examples of System Calls
Operating systems that comply with POSIX include Unix, Unix-like, and others. open, read, write, close, wait, exec, fork, exit, and kill
Windows CreateFile, ReadFile, WriteFile, CloseHandle, WaitForSingleObject, CreateProcess, ExitProcess
Linux open, read, write, close, waitpid, execve, fork, exit
FreeBSD openat, readv, writev, closefrom, wait4, execveat, fork1
macOS open, read, write, close, waitpid, execve, fork

upGrad offers a Master of Science in Computer Science from LJMU, specialising in Full Stack Development. The programme includes 1-1 mentorship and covers topics such as web development, database systems, and software engineering to easily understand what is a system call in an operating system.

Coverage of AWS, Microsoft Azure and GCP services

Certification8 Months

Job-Linked Program

Bootcamp36 Weeks

Conclusion

System calls are essential to operating systems because they provide user-level applications to connect with the kernel at the system level. They provide a bridge between user programs and the operating system to request various services, including file operations, process management, memory management, and network connection.

The upGrad Executive PG Programme in Full Stack Development from IIITB is a 13-month online programme that covers in-depth key software development concepts. The program covers web development, front-end and back-end technologies, databases, and more. Sign up today to learn more about the types of system call in an operating system. 

Frequently Asked Questions (FAQs)

1. What services are provided by system calls?

2. What is system calls in operating system and Why does one need?

3. How can one find information about system calls in a specific operating system?

Pavan Vadapalli

900 articles published

Get Free Consultation

+91

By submitting, I accept the T&C and
Privacy Policy

India’s #1 Tech University

Executive PG Certification in AI-Powered Full Stack Development

77%

seats filled

View Program

Top Resources

Recommended Programs

upGrad

AWS | upGrad KnowledgeHut

AWS Certified Solutions Architect - Associate Training (SAA-C03)

69 Cloud Lab Simulations

Certification

32-Hr Training by Dustin Brimberry

upGrad KnowledgeHut

upGrad KnowledgeHut

Angular Training

Hone Skills with Live Projects

Certification

13+ Hrs Instructor-Led Sessions

upGrad

upGrad KnowledgeHut

AI-Driven Full-Stack Development

Job-Linked Program

Bootcamp

36 Weeks