Home > System Tutorial > LINUX > body text

Analysis and application of Linux kernel 2.1 single kernel and microkernel application system

王林
Release: 2024-02-13 18:45:27
forward
547 people have browsed it

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

嵌入式linux驱动编程实验_嵌入式linux高级驱动教程_嵌入式linux驱动开发教程

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

嵌入式linux驱动开发教程_嵌入式linux驱动编程实验_嵌入式linux高级驱动教程

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!

Related labels:
source:itcool.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!