System call
lastmod 2019-04-25created 2019-04-251 edits
A system call is an interface for accessing the kernel, at the request of an application, for services provided by the operating system's kernel. Programs written in high-level languages such as C or C++ usually cannot use system calls directly, so this is a way to access system calls through a high-level API.
By the structure of an operating system, the kernel and applications differ in CPU privilege levels and in their ability to access hardware. The kernel has a linker structure whose physical addresses match the RAM/FLASH etc. of the CPU system, and runs at a specific memory location. All addresses used in the kernel's machine code are fixed to physical addresses when it is compiled, loaded, and executed. Therefore the kernel occupies a fixed part of the total memory resources during booting, and can access all hardware, including interrupts. Applications, however, use the resources provided by the kernel, so they occupy different locations in memory depending on the situation when they run. Since an application is a program run at the user's request, its physical address cannot be fixed. Therefore, when an application is written, it is linked by the development tools on the assumption that it is loaded from the start of memory. Logical addresses are usually translated to physical addresses through the MMU. Applications also run at the CPU privilege level of user space and cannot execute certain machine instructions. In this situation, applications must rely on the kernel in many cases, such as using the file system. The way an application uses the kernel's services is the system call. Programming processes such as the kernel's interrupt handling is done with a mixed structure of assembly language and C. And since the structure and conditions of CPUs and computer systems differ, the code is written separately for each CPU, and the sources are written, stored, and managed separately in the kernel source folder structure. asmlinkage is a reserved word related to assembly language.