Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Linux kernel like?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what the Linux kernel is like". In the daily operation, I believe many people have doubts about what the Linux kernel is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what the Linux kernel is like!" Next, please follow the editor to study!

The kernel is the core component of the Linux operating system, which connects applications up and down to deal directly with the hardware. Its code is mainly written in C language and a small amount of assembly language, and it can adapt to a variety of different hardware architectures.

The kernel runs a series of processes concurrently and manages all kinds of hardware resources. Specifically, because of the limited resources of the system, the kernel allocates resources such as CPU time, memory space, network connection and so on to each process.

Linux operating system architecture

The following figure is a typical Linux operating system architecture diagram.

The Linux operating system is mainly divided into two parts:

User space

Kernel space

1. User space

All user applications run in user space, they can not directly access hardware resources such as memory, but indirectly through the kernel. The GNU C library (glibc) provides a mechanism for switching from user space to kernel space.

two。 Kernel space

The kernel directly manages the CPU, memory, input and output devices, network devices and other peripherals of the system. It is divided into different modules to manage different operations of the system, such as file management, memory management, process management and so on.

Applications in user space can access hardware resources by calling API provided by the kernel. For example, for file operations, we can call open (), read (), write (), and other interfaces.

The kernel manages the hardware directly and is independent of the hardware. It can be simply configured and then run on Intel,ARM, Atemel and other chip architectures.

Main subsystems of Linux kernel

According to the core functions of the kernel, the Linux kernel proposes five subsystems, namely: system call, process management, memory management, file system, and network management, as shown below:

1. System call (System Call Interface)

The system calls the interface. Through the system call interface, the process scheduling subsystem opens out the interface that needs to be provided to the user space, and shields out the details that do not need to be concerned about by the user space program.

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.

two。 Process Management (Process Management)

There are so many processes in user space, how to get them to proceed methodically is exactly what process management needs to do. Each process uses CPU resources (such as CPU, memory), but CPU resources are limited, so it is impossible for a process to monopolize resources.

Therefore, process management acts as an administrator, scheduling all processes. When the next process needs to be selected to run, the scheduling algorithm will select the process that needs to run most. If a process is waiting for other hardware resources, it will be suspended.

Therefore, through a series of scheduling algorithms, the kernel uses CPU resources as fairly as possible for each process.

3. Memory Management (Memory Management)

Memory management mainly provides access control to memory resources so that each process can safely share the machine's memory resources. It provides a mapping between physical memory and virtual memory, so that different processes can use the same virtual memory, and these same virtual memory can be mapped to different physical memory. This mapping relationship is mainly done by MMU.

In addition, memory management provides a mechanism for virtual memory, which allows processes to use more memory than is available to the system, and unused memory is stored in external non-volatile memory through the file system and fetched back into memory when needed.

4. Virtual file system (Virtual File System)

The kernel hides the details of external devices with different functions, such as hard drives, input and output devices, display devices, and so on, and abstracts them as accessible through a unified file operation interface (open, close, read, write, etc.), which is known as "everything is a file".

With the development of computer technology, there are many kinds of file systems in history, such as FAT, FAT32, NTFS, EXT2, EXT3 and so on. In order to be compatible with these file systems, the kernel abstracts them into a unified representation, which is the concept of virtual file systems.

Virtual file system can be divided into logical file system and device driver. Logical file system refers to the file system supported by Linux, such as ext2, fat, etc., and device driver refers to the device driver module written for each kind of hardware controller.

5. Network Management (Network Stack)

In the Linux kernel, the network subsystem is mainly responsible for managing all kinds of network devices, implementing various network protocol stacks, and finally realizing the function of connecting other systems through the network.

The network interface provides access to various network standard protocols and support for all kinds of network hardware. The network interface can be divided into two parts: network protocol and network driver. The network protocol part is responsible for implementing every possible network transmission protocol, the network device driver is responsible for communicating with hardware devices, and each possible hardware device has a corresponding device driver.

At this point, the study of "what the Linux kernel is like" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report