In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
According to the example analysis of the brief introduction of Linux kernel system, I believe that many inexperienced people do not know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Brief introduction of 1.Linux Kernel
Now let's take a look at the architecture of the GNU/Linux operating system from a higher perspective. You can consider the operating system at two levels, as shown in figure 1.
Figure 1. Basic architecture of the GNU/Linux operating system
At the top is the user (or application) space. This is where the user application executes. Below user space is the kernel space, where the Linux kernel is located.
GNU C Library (glibc) is also here. It provides a system call interface to connect to the kernel and a mechanism to convert between user-space applications and the kernel. This is important because kernel and user-space applications use different protected address spaces. Each user-space process uses its own virtual address space, while the kernel occupies a separate address space.
The Linux kernel can be further divided into three layers. At the top is the system call interface, which implements some basic functions such as read and write. Beneath the system call interface is the kernel code, which can be more precisely defined as architecture-independent kernel code. This code is common to all processor architectures supported by Linux. Beneath this code is architecture-dependent code that forms a part commonly referred to as BSP (Board Support Package). This code is used as a processor for a given architecture and platform-specific code.
In the Linux kernel, it includes
Process Management (process management)
Timer (timer)
Interrupt Management (interrupt management)
Memory Management (memory management)
Module Management (module management)
Virtual File system Interface (VFS layer)
File system (file system)
Device driver (device driver)
Interprocess communication (inter-process communication)
Network Management (network management)
Realization of operating system functions such as system boot (system init).
The main subsystems of the 2.Linux kernel
Now use the categories in figure 2 to illustrate the main components of the Linux kernel.
Figure 2. An architectural perspective of the Linux kernel
What is the kernel?
The kernel is really just a resource manager. Regardless of whether the managed resource is a process, memory, or hardware device, the kernel is responsible for managing and determining the access of multiple competing users to the resource (including both kernel space and user space)
System call interface
The SCI layer provides some mechanisms to perform function calls from user space to the kernel. As discussed earlier, this interface depends on architecture, even within the same processor family. SCI is actually a very useful function call multiplexing and demultiplexing service. You can find the implementation of SCI in. / linux/kernel and the architecture-dependent parts in. / linux/arch. More details on this component can be found in the Resources section.
Process management
The focus of process management is the execution of processes. In the kernel, these processes are called threads and represent separate processor virtualization (thread code, data, stack, and CPU registers). In user space, the term process is commonly used, but the Linux implementation does not distinguish between the two concepts (process and thread). The kernel provides an application programming interface (API) through SCI to create a new process (fork, exec, or Portable Operating System Interface [POSIX] function), stop the process (kill, exit), and communicate and synchronize between them (signal or POSIX mechanism).
Process management also includes dealing with the need to share CPU between active processes. The kernel implements a new scheduling algorithm that can operate within a fixed time no matter how many threads are competing for CPU. This algorithm is called the O (1) scheduler, which means that it takes the same time to schedule multiple threads as it takes to schedule a thread. The O (1) scheduler can also support multiprocessors (called symmetric multiprocessors or SMP). You can find process-managed source code in. / linux/kernel and architecture-dependent source code in. / linux/arch. You can learn more about this algorithm in the Resources section.
Memory management
Another important resource managed by the kernel is memory. To improve efficiency, if virtual memory is managed by hardware, it is managed in a so-called memory page manner (4KB for most architectures). Linux includes ways to manage available memory, as well as hardware mechanisms used for physical and virtual mapping.
But memory management doesn't just manage 4KB buffers. Linux provides abstractions for 4KB buffers, such as the slab allocator. This memory management model uses 4KB buffers as the cardinality, allocates structures from them, and tracks memory page usage, such as which pages are full, which pages are not fully used, and which pages are empty. This allows the mode to dynamically adjust memory usage according to system needs.
In order to support multiple users to use memory, there are sometimes situations where available memory is consumed. For this reason, pages can be moved out of memory and placed on disk. This process is called swapping because pages are swapped from memory to the hard disk. The source code for memory management can be found in. / linux/mm.
Virtual file system
Virtual file system (VFS) is a very useful aspect of the Linux kernel because it provides a common interface abstraction for file systems. VFS provides a switching layer between SCI and the file systems supported by the kernel (see figure 3).
Figure 3. VFS provides a switching layer between the user and the file system
Above VFS is a generic API abstraction of functions such as open, close, read, and write. Below VFS is the file system abstraction, which defines how the upper-level functions are implemented. They are plug-ins for a given file system (more than 50). The source code for the file system can be found in. / linux/fs.
Below the file system layer is the buffer cache, which provides a common set of functions for the file system layer (independent of the specific file system). This cache layer optimizes access to physical devices by keeping the data for a period of time (or then reading the data in advance to be available when needed). Beneath the buffer cache is the device driver, which implements the interface to a specific physical device.
Network stack
The network stack is designed to follow the hierarchical architecture of the simulation protocol itself. Recall that Internet Protocol (IP) is the core network layer protocol under the transport protocol (commonly referred to as the transmission control protocol or TCP). Above the TCP is the socket layer, which is called through SCI.
The socket layer is the standard API of the network subsystem, which provides a user interface for various network protocols. From the original frame access to the IP Protocol data Unit (PDU), to TCP and User Datagram Protocol (UDP), the socket layer provides a standardized way to manage connections and move data between endpoints. The network source code in the kernel can be found in. / linux/net.
Device driver
There is a lot of code in the Linux kernel that resides in device drivers that can run specific hardware devices. The Linux source tree provides a driver subdirectory, which is further divided into various supporting devices, such as Bluetooth, I2C, serial, and so on. The device driver code can be found in. / linux/drivers.
Architecture-dependent code
Although Linux is largely independent of the architecture on which it is running, some elements must consider the architecture in order to operate properly and achieve greater efficiency. The. / linux/arch subdirectory defines the architecture-dependent parts of the kernel source code, which contain various architecture-specific subdirectories (which together make up the BSP). For a typical desktop system, the i386 directory is used. Each architectural subdirectory contains many other subdirectories, and each subdirectory focuses on a specific aspect of the kernel, such as boot, kernel, memory management, and so on. This architecture-dependent code can be found in. / linux/arch.
After reading the above, have you mastered the method of case analysis in the brief introduction of Linux kernel system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.