System calls are the classical method of enabling user processes to interact with the kernel. The POSIX standard defines a number of system calls and their effect as implemented on all POSIX-compliant systems including Linux. Traditional system calls are grouped into various categories:
□ Process Management — Creating new tasks, querying information, debugging
□ Signals — Sending signals, timers, handling mechanisms
□ Files — Creating, opening, and closing files, reading from and writing to files, querying information and status
□ Directories and Filesystem — Creating, deleting, and renaming directories, querying information, links, changing directories
□ Protection Mechanisms — Reading and changing UIDs/GIDs, and namespace handling
□ Timer Functions — Timer functions and statistical information
Demands are placed on the kernel in all these functions. They cannot be implemented in a normal user library because special protection mechanisms are needed to ensure that system stability and/or security are not endangered. In addition, many calls are reliant on kernel-internal structures or functions to yield desired data or results — this also dictates against implementation in userspace. When a system call is issued, the processor must change the privilege level and switch from user mode to system mode. There is no standardized way of doing this in Linux as each hardware platform offers specific mechanisms. In some cases, different approaches are implemented on the same architecture but depend on processor type. Whereas Linux uses a special software interrupt to execute system calls on IA-32 processors, the software emulation (iBCS emulator) of other Unix systems on IA-32 employs a different method to execute binary programs (for assembly language aficionados: the lcall7 or lcall27 gate). Modern variants of IA-32 also have their own assembly language statement for executing system calls; this was not available on old systems and cannot therefore be used on all machines. What all variants have in common is that system calls are the only way of enabling user processes to switch in their own incentive from user mode to kernel mode in order to delegate system-critical tasks.
Continue reading here: Device Drivers Block and Character Devices
Was this article helpful?