1. Operating system and Kernel
Operating systems are those parts of the entire system that are responsible for the most basic functions and systems management. Includes kernels, device drivers, boot bootstrapper, command-line shell, or other kinds of user interfaces, basic file management tools, and system tools.
The user interface is the external manifestation of the operating system, and the kernel is the built-in core.
Applications running in the system communicate with the kernel through system calls. The application usually calls the library function and then the library function through the system call interface, let the kernel do a variety of different tasks on its behalf . Some library calls provide a number of features that the system call does not have, and in those more complex functions, invoking the kernel is usually just a step in the work. For example, the printf function, which provides operations such as caching and formatting data, and write is just one of the actions, and some library functions correspond to a system call of one by one, for example, the Open library function and the open system call. Some library functions do not need to directly invoke system-level operations, such as strcpy ().
1) When running in user space, the user process is executed
2) run in kernel space, in the process context, at which point the kernel executes in kernel space on behalf of a particular process.
3) running in kernel space, in the interrupt context, regardless of any process, the kernel handles a specific interrupt on behalf of the hardware.
Chapter One introduction to the Linux kernel