Process managers can give experienced computer users and administrators an accurate overview of which programs and services are taking up the system’s capacity. Classic command-line tools are confusing, and can only be controlled with complicated commands. For Unix-like systems, such as Ubuntu, the task manager htop, with its text interface, is a first-class alternative. It can help inexperienced...
Especially nowadays, operating systems have to provide users not only with the highest possible level of comfort, but also with maximum stability and security. That is why the developers of systems like Linux or Windows endeavour to keep the risk of potential system complications resulting from unintentional negligence or of targeted attacks from outside as low as possible. One of the most important steps taken to this end is the strict separation of the operation system core (the kernel) and application programs or user processes. The consequence of this is that programs and processes that do not belong to the system have no direct access to the CPU and the memory, and instead rely on so-called system calls.
What exactly do these calls involve, and what kinds are there?
What is a system call (syscall)?
A system call, or syscall for short, is a method used by application programs to communicate with the system core. In modern operating systems, this method is used if a user application or process needs to pass information onto the hardware, other processes or the kernel itself, or if it needs to read information from these sources. This makes these calls a link between user mode and kernel mode, the two key access and security modes for processing CPU commands in computer systems.
Until a system call has been processed and the data required has been transmitted or received, the system core takes control of the program or process, which will temporarily stop running. As soon as the action required by a system call is carried out, the kernel returns control, and the program code is continued from the point it had reached before the syscall was started.
Most modern operating systems makes certain system calls available as library functions, which can be executed via a program interface that is also provided. This makes software developers’ work much easier, as it means no precise knowledge of the internal functionalities of different system software is then needed.
Why are system calls necessary?
The need for system calls is closely tied to the modern operating system model with user mode and kernel mode, which was implemented as a response to the rising number of processes being carried out simultaneously in computers’ main memory (working memory). In this way, each individual process has its own data with special access permissions, and it is only possible for system and application programs to run properly if resources are divided up fairly.
The more privileged kernel mode is the pivotal control system here because – as mentioned already – not only are all services and processes in the system itself run there, but also system-critical actions by application programs that are blocked in user mode. One requirement is the right system call through the respective program, which in most cases is simply for access to processing power (CPU) or memory structures (working memory and hard drive space). If an application needs more computing power or storage space, for example, or an application-external file (open, read, edit, etc.) is required, system calls are essential.
To put it simply, system calls are necessary whenever a process running in user mode needs to run a function that can only be run in the kernel mode.
What kinds of system calls are there?
As already mentioned, all system calls can essentially be used as control units for the communication between application processes and the operating system or the hardware. Established system calls can also be classified into different categories, though, whereby the following five classification types are generally accepted:
- Process control: All processes in a computer system must be monitored so that they can be stopped at any time or be controlled by other processes. For this reason, system calls in this category monitor the start and running or the abortion of processes.
- File management: This kind of system call is needed by application programs to gain access to typical file operations. These methods of file manipulation include ‘create’, ‘delete’, ‘open’, ‘close’, ‘write’ and ‘read’.
- Device management: This category includes all system calls that request or manage hardware resources such as processing power or storage space.
- Information maintenance: Processes are linked to a great deal of information that must be up-to-date and correct. To exchange or demand this information, application programs use system calls to manage and maintain information.
- Inter-process communication: The operating system and the various active application programs are only guaranteed to interact smoothly if the individual processes are well-coordinated with one another. For this reason, communication via relevant system calls is essential.
Windows and Linux: An overview of system calls
The extent to which the kinds of system calls listed can be made and implemented depends primarily on the hardware and the system architecture in use, but also on the operating system used. In Linux, for example, system calls are stored directly in the Linux core in the ‘system call table’. Each entry in this table is assigned a unique number and a certain function to be run in kernel mode. To execute any desired Linux system call, the respective number is loaded in the CPU memory and then loaded with software interrupt 128 (a cue for a subfunction of the operating system that interrupts the program running in user mode).
The process is similar in Windows systems, where a system call is always converted internally first. However, from a library function in the Windows API (WinAPI or short), a system call that can be read by the operating system is automatically made with a unique number that refers to the desired function in kernel mode.
You can find some examples of specific Windows and Linux system calls in the following table:
|Type of system call||Function||Linux||Windows|
|Process control||Create a process||fork()||CreateProcess()|
|Process control||End a process||exit()||ExitProcess()|
|File management||Create/open a file||open()||CreateFile()|
|File management||Read a file||read()||ReadFile()|
|File management||Edit a file||write()||WriteFile()|
|File management||Close a file||close()||CloseHandle()|
|Device management||Open a device||read()||ReadConsole()|
|Device management||Close a device||close()||CloseConsole()|
|Information maintenance||Set a certain time interval||alarm()||SetTimer()|
|Information maintenance||Pause (e.g. a process)||sleep()||Sleep()|
|Communication||Create a pipe (buffer for data flow between two processes)||pipe()||CreatePipe()|
|Communication||Create shared memory||shmget()||CreateFileMapping()|
Are you looking for high-performance hardware to handle your application processes? VPS solutions by IONOS provide you with the most modern cloud-based server at a fantastic price – with a choice of a Windows or Linux operating system.