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 are the different system calls in the operating system?
System calls are programming interfaces that allow applications to request services from the operating system kernel. They provide a controlled way for user programs to interact with hardware resources, files, processes, and other system components. The operating system provides different categories of system calls to handle various types of operations.
The different system calls are as follows −
System calls for Process management
System calls for File management
System calls for Directory management
System calls for Device management
System calls for Information maintenance
System calls for Communication
Let us understand them one by one.
System calls for Process Management
Process management system calls handle the creation, execution, and termination of processes. The fork() system call creates a duplicate process called a child process from the existing parent process. The child process inherits all data, file descriptors, and register values from the parent.
The fork() call returns different values to distinguish between processes − it returns 0 to the child process and the child's PID (Process Identifier) to the parent process. The exec() family of calls loads a new program into the current process memory space, replacing the original program image.
Common Process Management System Calls
| System Call | Purpose | Description |
|---|---|---|
fork() |
Process creation | Creates a duplicate child process from parent |
exec() |
Program execution | Loads and executes a new program |
wait() |
Process synchronization | Parent waits for child process completion |
exit() |
Process termination | Terminates the calling process |
System calls for File Management
File management system calls provide operations for creating, opening, reading, writing, and closing files. The open() system call opens a file with specified access modes (read, write, append). Each opened file is associated with a file descriptor and a file pointer that indicates the current position in the file.
The lseek() system call repositions the file pointer to allow random access within the file. It takes three parameters − the file descriptor, the new position offset, and the reference point (beginning, current position, or end of file).
Common File Management System Calls
| System Call | Purpose | Description |
|---|---|---|
open() |
File opening | Opens a file for reading, writing, or both |
close() |
File closing | Closes an opened file and releases resources |
read() |
Data input | Reads data from file into buffer |
write() |
Data output | Writes data from buffer to file |
lseek() |
Position control | Changes file pointer position |
System calls for Directory Management
Directory management system calls handle operations on directories and file system structure. The mkdir() system call creates new empty directories, while rmdir() removes empty directories from the file system.
The link() system call creates multiple directory entries (hard links) pointing to the same file, allowing the same file to appear under different names across directories. This enables file sharing among users while maintaining a single copy of the actual file data.
The mount() system call integrates file systems from different storage devices (USB drives, network drives) into a unified directory tree, making them accessible through the main file system hierarchy.
Common Directory Management System Calls
| System Call | Purpose | Description |
|---|---|---|
mkdir() |
Directory creation | Creates a new empty directory |
rmdir() |
Directory removal | Removes an empty directory |
link() |
File linking | Creates additional directory entries for files |
mount() |
File system mounting | Attaches file systems to directory tree |
Additional System Call Categories
Device Management
System calls like ioctl(), read(), and write() handle communication with hardware devices such as printers, disk drives, and network interfaces.
Information Maintenance
Calls like getpid(), time(), and getuid() retrieve system information such as process IDs, current time, and user identifications.
Communication
System calls like pipe(), socket(), and msgget() enable inter-process communication and network communication between processes.
Conclusion
System calls serve as the essential bridge between user applications and the operating system kernel. They provide controlled access to system resources through well-defined interfaces for process management, file operations, directory handling, and system communication. Understanding system calls is fundamental to systems programming and operating system design.
