LINFO

System Call Definition



A system call, sometimes referred to as a kernel call, is a request in a Unix-like operating system made via a software interrupt by an active process for a service performed by the kernel.

A process (also frequently referred to as a task) is an executing (i.e., running) instance of a program. An active process is a process that is currently progressing in the CPU (central processing unit), as contrasted with processes that are waiting for their next turns in the CPU.

An interrupt is a signal to the kernel that an event has occurred, and this results in changes in the sequence of instructions that is executed by the CPU. A software interrupt, also referred to as an exception, is an interrupt that originates in software, usually by a program in user mode.

User mode is one of two distinct execution modes of operation for the CPU in Linux. It is a non-privileged mode in which each process starts out. It is non-privileged in that processes in this mode are not allowed to access those portions of memory that have been allocated to the kernel or to other programs.

The kernel is a program that constitutes the core of an operating system, and it has complete control over all resources on the system and everything that occurs on it. When a user mode process (i.e., a process currently in user mode) wants to utilize a service provided by the kernel (i.e., access system resources other than the limited memory space that is allocated to the user program), it must switch temporarily into kernel mode, also called system mode, by means of a system call.

Kernel mode has root (i.e., administrative) privileges, including root access permissions (i.e., permission to access any memory space or other resources on the system). This allows the operating system to perform restricted actions such as accessing hardware devices or the memory management unit (MMU). When the kernel has satisfied the request made by a process, it restores that process to user mode. The MMU is a type of circuitry that is responsible for handling memory access requested by the CPU.

System calls can also be viewed as clearly-defined, direct entry points into the kernel through which programs request services from the kernel. They allow programs to perform tasks that would not normally be permitted.

Examples of the services performed by the kernel include as input/output (I/O) and process creation. The former can be defined as any movement of data to or from the combination of the CPU and main memory (i.e. RAM), that is, communication between this combination and the computer's users (e.g., via the keyboard or mouse), its storage devices (e.g., disk or tape drives) or other computers. Process creation is the creation of a new process.

A system call is accomplished in Linux on x86 (i.e., Intel-compatible) processors by calling the interrupt 0x80 (i.e., int 0x80) together with the register values. A register is a very small amount of high speed memory inside of the CPU. int 0x80 is the assembly language instruction that is used to invoke system calls in Linux on x86 processors. The calling of this instruction is preceded by the storing in the process register of the system call number (i.e., the integer assigned to each system call) for that system call and any arguments (i.e., input data) for it.

System calls can be classified into six groups: process management, interprocess communication, memory management, file system, initialization and other. The kernel maintains a list of all registered system calls in the system call table. This table assigns each valid system call a unique system call number which cannot be changed or recycled. Processes do not refer to system calls by name, but rather by their system call number.






Created April 27, 2006.
Copyright © 2006 Bellevue Linux. All Rights Reserved.