Kernel Learning: The knowledge point of system call

Source: Internet
Author: User
Tags posix linux

In general, user processes are not able to access kernel space. It can neither access the data in the kernel nor access the functions in the kernel. In the Linux kernel, however, a set of functions for implementing various system functions became a system call. Users can call them in the application.

The Linux system also provides a number of C libraries that are packaged and extended to system calls.

System calls, POSIX,C libraries, system commands, and kernel functions

1, system calls and POSIX

Although system calls are a bridge between the kernel and user space, the user's application accesses the kernel through the application programming interface API provided by the system.

The main function of the operating system API is to show the function of the operating system fully and provide it to the application.

The most common operating system APIs in UNIX are based on the POSIX (Portable operating system Ofunix) standard. Later versions from UNIX were so varied that they caused great inconvenience to application porting. To end this situation IEEE has developed a POSIX standard to improve the portability of user programs in UNIX environments. POSIX standards are not limited to UNIX, and many other operating systems support the standard such as Dec OpenVMS and Windownt. The Linux system is compatible with the POSIX standard and provides API functions that are defined by POSIX. These functions have a direct relationship with system calls. An API function can be implemented using one system call, or multiple system calls. It is also implemented without system calls.

2, System calls and C library

The API for the operating system is usually provided by the C library, and so is Linux. C Library provides a large number of POSIX-compliant APIs. Each system call provided by the kernel has a corresponding function encapsulation in the C library. Also, the system call name and the function name encapsulated in the C library are often the same. such as read

Functions encapsulated in the C library do a little work before calling system calls. such as system calls truncate and truncate64 encapsulated in the library truncate determine which system call is invoked.

Encapsulated functions and system calls are not one by one correspondence. Some encapsulation functions do not even call any system calls such as strcpy and Atoi

3, System calls and system commands

The system command is the higher layer of the C library. is an application implemented using the C library. such as LS command.

Strace can track system calls.

4, system calls and kernel functions

You can think of a kernel function as part of a system call.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.