


Analysis and application of Linux kernel 2.1 single kernel and microkernel application system
Table of contents
1. Two forms of application systems 1.1 Application system without operating system
For simple SOC applications, such as most simple-function microcontroller applications, there is no need to use an operating system in the system. At this time, the application directly calls the corresponding driver to operate the underlying hardware, as shown in the figure:
With these structures, the application software directly calls the device driver to operate the hardware. The advantages are: simple, direct and efficient. Suitable for small and simple systems. For complex systems, application systems that need to share hardware resources in different functions, this method is obviously not suitable.
1.2. Application system with operating system
For complex application systems, in application scenarios where hardware and other resources need to be shared between functional modules, an operating system needs to be added to the application system. For this purpose, the application system is as shown on the right:
As shown in the figure, with the operating system Hongqi Linux official website, applications can use the unified socket of the operating system API regardless of specific hardware details, which is conducive to large-scale standardized development and improves development efficiency.
The driver also uses the standard device socket provided by the operating system downwards and operates different hardware upwards. This shields the operating system layer from hardware details. The operating system thus appears more stable and efficient.
2. Linux kernel 2.1 single kernel and microkernel
Currently, the operating system has two typical kernel implementation modes:
Linux is a single-kernel linux learning that runs on a separate address space. However, Linux has absorbed the refinement of the microkernel and has the modular design, preemptive kernel, support for kernel threads, and the ability to dynamically load kernel modules that the microkernel has. At the same time, Linux also prevents the design flaws of microkernelsEmbedded Linux Advanced Driver Tutorial. Linux allows all modules to run in the kernel state and call functions directly without using message passing like microkernels.
2.2Linux kernel composition
As shown in the figure, the Linux kernel mainly consists of five parts:
2.3 Process Scheduling
Process scheduling is at the center of the system, and other parts of the system depend on it. Linux processes have a total of six states, and the process can switch between these states throughout its life cycle.
2.4 Video memory management
The main function of video memory management is to control the safe shared main video memory domain of multiple processes. Each Linux process on a 32-bit processor enjoys 4G space. Usually 0-3G belongs to user space and 3G-4G belongs to kernel space. As shown on the right
2.5 Virtual File System
The Linux virtual file system hides the specific details of various types of hardware and provides a unified socket for all devices. It is a concrete representation of each specific file system.
As shown in the figure, the virtual file system provides a unified calling socket for the underlying application program, which is responsible for calling the member functions in the file_operations structure implemented in the specific underlying file system or device driver.
2.6 Network socket
The network socket provides access to various network standards and support for various network hardware. Linux network sockets are divided into
2.7 Inter-process communication
Inter-process communication is responsible for communication between processes, including semaphores, shared memory, message queues, pipes, UNIX domain sockets, etc.
3. Kernel space and user space
Modern CPUs will internally distinguish different working modes to distinguish operations of different levels and permissions.
For example, ARM’s 8 working modes:
In the ARM environment, the Linux system fully utilizes the hardware characteristics of the CPU to implement two-level operating modes, user (usr) mode and management mode (svc). Correspondingly, there are two types of spaces in the Linux system:
3.1 Supplement: About soft interrupt
qquadHere is a chart of ARM’s abnormal working mode
During normal execution, ARM is in user mode. When the CPU executes the swi instruction, it will manually enter the system mode (SVCmode) and jump to the exception vector table. Jump to the corresponding function through the vector table to respond to swi.
The SVC mode here is the abbreviation of SupervisorCall, which in English is supervisor call.
4. Linux device driver 4.1 Device classification in Linux system
Linux system divides peripheral hardware into three major categories:
4.2linux driver related system
As shown in the figure, character devices and block devices are mapped to files and directories in the Linux file system.
Applications can access network devices through socketsEmbedded Linux Advanced Driver Tutorial, and use two methods to access character devices and block devices:
The above is the detailed content of Analysis and application of Linux kernel 2.1 single kernel and microkernel application system. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

As the core part of the operating system, the Linux kernel is responsible for important functions such as managing hardware resources and providing system calls. This article will delve into the five major parts of the Linux kernel, including process management, file system, network communication, device driver and memory management, and provide a detailed introduction and code examples. 1. Process Management Process Creation In the Linux kernel, process creation is implemented through the fork() system call. Here is a simple example code: #include

It’s long and has a lot of technical content, so click to follow it and you won’t get lost. Preface: Understanding the Linux Kernel A computer system is a symbiosis of hardware and software. They are interdependent and inseparable. Computer hardware Linux kernel transplantation steps include peripheral devices, processors, memory, hard drives and other electronic devices that make up the computer cylinder. And without software to operate and control it, it cannot work by itself. The software that completes this control work is called the operating system. In Linux terminology, it is called the "kernel" or "core". The main modules (or components) of the Linux kernel are divided into the following parts: storage management, CPU and process management, file system, device management and driver, network communication Linux forum, and system

The previous article analyzed the page table creation for RISC-V Linux startup. It was mentioned that the RISC-V Linux entry address must be 2M aligned. Today I will talk about how to solve the 2M alignment problem, or how to optimize part of the memory.

Hello dear readers! Here, I am honored to share with you the valuable experience and skills I have accumulated as a senior network engineer with my professional skills in the development and optimization of the Linux kernel TCP protocol stack. I believe that through this article, we can learn from each other and discuss it, and bring practical and useful reference materials to you who have a strong interest in this field or are currently working on it. 1. TCP connection establishment TCP connection establishment is a key transaction of the TCP protocol stack, but it is not uncommon to face many connection problems. After careful consideration and detailed debugging, I discovered some common and practical problems and their solutions, including preventing SYN flooding attacks (by adjusting system parameters) and dealing with network congestion (that is, using TCPFastOp

The Android system and the Linux kernel are two closely related entities, and the relationship between them is close and complex. In the Android system, the Linux kernel plays an important role, providing underlying hardware drivers and system call support for the Android system. This article will explore the relationship between the Android system and the Linux kernel, how they interact and work together, and provide some specific code examples. Android is a mobile operating system developed based on the Linux kernel and is mainly used for mobile devices such as smartphones and tablets. L

This is a 1500-word article that explores the Linux kernel source code distribution in depth. Due to limited space, we will focus on the organizational structure of the Linux kernel source code and provide some specific code examples to help readers better understand. The Linux kernel is an open source operating system kernel whose source code is hosted on GitHub. The entire Linux kernel source code distribution is very large, containing hundreds of thousands of lines of code, involving multiple different subsystems and modules. To gain a deeper understanding of the Linux kernel source code

Discusses the view that the Linux kernel plays an important role in computer operating systems. Linux kernel design and implementation. Through in-depth analysis of Linux kernel design and practical applications, it reveals its prominent position and influence in this field. 1. Optimized memory management By using virtual memory management technology, the Linux kernel can efficiently complete memory allocation and recycling. With the help of the replacement page algorithm, the Linux kernel is designed and implemented to accurately handle the mapping relationship between physical memory and virtual memory. Flexible adjustments can be made based on the specific needs of the application, thereby improving overall system performance. 2. The powerful process management kernel uses its excellent multi-tasking technology to enable multiple processes to coexist harmoniously in a single system. Carefully formulated

The Linux kernel is the core of the operating system and controls access to system resources such as the CPU, I/O devices, physical memory, and file systems. During the boot process and while the system is running, the kernel writes various messages to the kernel ring buffer. These messages include a variety of information about system operations.
