提交 0c887312 编写于 作者: O openharmony_ci 提交者: Gitee

!590 内核开发指南文档根据社区意见优化

Merge pull request !590 from kenneth/kernel_m_comments
......@@ -69,7 +69,7 @@
- [Interrupt and Exception Handling](kernel-small-basic-interrupt.md)
- [Process Management](kernel-small-basic-process.md)
- [Process](kernel-small-basic-process-process.md)
- [Thread](kernel-small-basic-process-thread.md)
- [Task](kernel-small-basic-process-thread.md)
- [Scheduler](kernel-small-basic-process-scheduler.md)
- [Memory Management](kernel-small-basic-memory.md)
- [Heap Memory Management](kernel-small-basic-memory-heap.md)
......
......@@ -156,13 +156,14 @@ Example:
struct MyType { // Add a comment here, and leave a space between the comment sign (//) and the comment.
...
}; // The right brace is followed by a semicolon (;).
int Foo(int a) {// The left brace of the function is placed at the beginning of a line and occupies one line.
int Foo(int a)
{ // The left brace of the function is placed at the beginning of a line and occupies one line.
if (a > 0) {
Foo(); // There is only one statement in a line.
Bar();
} else { // The right brace, else, and the subsequent left brace are in the same line.
...
} // The right brace occupies one line exclusively.
} // The right brace occupies one line exclusively.
...
}
```
......
......@@ -56,7 +56,7 @@ typedef struct {
This example implements the following:
1. Creates a monitoring thread to obtain information about the memory pool.
1. Creates a monitoring task to obtain information about the memory pool.
2. Calls **LOS\_MemInfoGet** to obtain the basic information about the memory pool.
......
......@@ -9,10 +9,9 @@
The OpenHarmony LiteOS-M kernel is a lightweight operating system \(OS\) kernel designed for the IoT field. It features small size, low power consumption, and high performance. The LiteOS-M kernel has simple code structure, including the minimum function set, kernel abstraction layer, optional components, and project directory.
The OpenHarmony LiteOS-M kernel architecture consists of the hardware-related layer and the hardware-irrelevant layer, as shown in [Figure 1](#fig17231457191415).
The OpenHarmony LiteOS-M kernel architecture consists of the hardware layer and the hardware-irrelevant layers, as shown in [Figure Kernel architecture](#fig17231457191415).
- The **Kernel arch** module belongs to the hardware-related layer. This module provides unified hardware abstraction layer \(HAL\) interfaces based on the compilation toolchain and chip architecture, improving hardware adaptability and meeting the expansion requirements of diversified AIoT hardware and compilation toolchains.
- **Components** and other modules belong to the hardware-irrelevant layer. Kernel modules, such as the task, provide basic capabilities. **Components** provide component capabilities, such as network and file system capabilities. **Utils** provides error handling and debugging capabilities. The Kernel Abstraction Layer \(**KAL**\) provides unified standard interfaces.
The hardware layer is classified based on the compilation toolchain and chip architecture, and provides a unified Hardware Abstraction Layer \(HAL\) interface to improve hardware adaptation and facilitate the expansion of various types of &IoT hardware and compilation toolchains. The basic kernel provides basic kernel capabilities. The extended modules provide capabilities of components, such as network and file systems, as well as exception handling and debug tools. The Kernel Abstraction Layer \(**KAL**\) provides unified standard APIs.
**Figure 1** Kernel architecture<a name="fig17231457191415"></a>
![](figure/kernel-architecture.png "kernel-architecture")
......
......@@ -54,7 +54,7 @@ typedef struct {
This example implements the following:
1. Creates a monitoring thread to obtain information about the memory pool.
1. Creates a monitoring task to obtain information about the memory pool.
2. Calls **LOS\_MemInfoGet** to obtain the basic information about the memory pool.
3. Calculates the memory usage and fragmentation rate.
......
......@@ -44,7 +44,7 @@ The lightweight kernel consists of the basic kernel, extension components, HDF,
The basic kernel implements the following mechanisms:
- Process management: supports processes and threads and task-based process implementation. Processes have independent 4 GB address space.
- Process management: supports processes and threads and task-based process implementation. Processes have independent 4 GiB address space.
- Multi-core scheduling: supports task and affinity-based interrupt-core binding settings.
- Real-time scheduling: Tasks are scheduled based on priorities. The tasks of the same priority are scheduled by using the time slice round-robin.
- Virtual memory: supports page fault. The kernel space is statically mapped to 0-1 GiB addresses, and the user space is mapped to 1-4 GiB addresses.
......
......@@ -86,7 +86,7 @@ The kernel startup process consists of the assembly startup and C language start
<tr id="row357517134414"><td class="cellrowborder" valign="top" width="35.58%" headers="mcps1.2.3.1.1 "><p id="p12575676449"><a name="p12575676449"></a><a name="p12575676449"></a>LOS_INIT_LEVEL_KMOD_TASK</p>
</td>
<td class="cellrowborder" valign="top" width="64.42%" headers="mcps1.2.3.1.2 "><p id="p7128122619143"><a name="p7128122619143"></a><a name="p7128122619143"></a>Kernel task creation</p>
<p id="p1657587184419"><a name="p1657587184419"></a><a name="p1657587184419"></a>Create kernel tasks (kernel thread and software timer tasks).</p>
<p id="p1657587184419"><a name="p1657587184419"></a><a name="p1657587184419"></a>Create kernel tasks (kernel tasks and software timer tasks).</p>
<p id="p55485297219"><a name="p55485297219"></a><a name="p55485297219"></a>Example: creation of the resident resource reclaiming task, SystemInit task, and CPU usage statistics task.</p>
</td>
</tr>
......
......@@ -67,7 +67,7 @@
- [中断及异常处理](kernel-small-basic-interrupt.md)
- [进程管理](kernel-small-basic-process.md)
- [进程](kernel-small-basic-process-process.md)
- [线程](kernel-small-basic-process-thread.md)
- [任务](kernel-small-basic-process-thread.md)
- [调度器](kernel-small-basic-process-scheduler.md)
- [内存管理](kernel-small-basic-memory.md)
- [堆内存管理](kernel-small-basic-memory-heap.md)
......
......@@ -4,7 +4,7 @@
- **[CPU占用率](kernel-mini-extend-cpup.md)**
- **[](kernel-mini-extend-dynamic-loading.md)**
- **[动态加载](kernel-mini-extend-dynamic-loading.md)**
- **[文件系统](kernel-mini-extend-file.md)**
......
......@@ -50,7 +50,7 @@ typedef struct {
本实例实现如下功能:
1.创建一个监控线程,用于获取内存池的信息;
1.创建一个监控任务,用于获取内存池的信息;
2.调用LOS\_MemInfoGet接口,获取内存池的基础信息;
......
......@@ -7,7 +7,7 @@
## 内核简介<a name="section1429342661510"></a>
OpenHarmony LiteOS-M内核是面向IoT领域构建的轻量级物联网操作系统内核,具有小体积、低功耗、高性能的特点。其代码结构简单,主要包括内核最小功能集、内核抽象层、可选组件以及工程目录等。OpenHarmony LiteOS-M内核架构包含硬件相关层以及硬件无关层,如下图所示,其中Kernel Arch模块属于硬件相关层,该模块按不同编译工具链、芯片架构分类,提供统一的HAL(Hardware Abstraction Layer)接口,提升了硬件易适配性,满足AIoT类型丰富的硬件和编译工具链的拓展;Components等其他模块属于硬件无关层,其中Kernel Task等内核模块提供基础能力,Components模块提供网络、文件系统等组件能力,Utils模块提供错误处理、调测等能力,KAL(Kernel Abstraction Layer)模块提供统一的标准接口。
OpenHarmony LiteOS-M内核是面向IoT领域构建的轻量级物联网操作系统内核,具有小体积、低功耗、高性能的特点。其代码结构简单,主要包括内核最小功能集、内核抽象层、可选组件以及工程目录等。OpenHarmony LiteOS-M内核架构包含硬件相关层以及硬件无关层,如下图所示,其中硬件相关层按不同编译工具链、芯片架构分类,提供统一的HAL(Hardware Abstraction Layer)接口,提升了硬件易适配性,满足AIoT类型丰富的硬件和编译工具链的拓展;其他模块属于硬件无关层,其中基础内核模块提供基础能力,扩展模块提供网络、文件系统等组件能力,还提供错误处理、调测等能力;KAL(Kernel Abstraction Layer)模块提供统一的标准接口。
**图 1** 内核架构图<a name="fig17231457191415"></a>
![](figure/内核架构图.png "内核架构图")
......
......@@ -48,7 +48,7 @@ typedef struct {
本实例实现如下功能:
1. 创建一个监控线程,用于获取内存池的信息;
1. 创建一个监控任务,用于获取内存池的信息;
2. 调用LOS\_MemInfoGet接口,获取内存池的基础信息;
3. 利用公式算出使用率及碎片率。
......
......@@ -44,16 +44,16 @@ OpenHarmony 轻量级内核是基于IoT领域轻量级物联网操作系统Huawe
基础内核组件实现精简,主要包括内核的基础机制,如调度、内存管理、中断异常、内核通信等;
- 进程管理:支持进程和线程,基于Task实现进程,进程独立4GB地址空间
- 进程管理:支持进程和线程,基于Task实现进程,进程独立4GiB地址空间
- 多核调度:支持任务和中断亲核性设置,支持绑核运行
- 实时调度:支持高优先级抢占,同优先级时间片轮转
- 虚拟内存:支持缺页异常,内核空间静态映射到0-1G地址,用户空间映射到1-4G地址
- 虚拟内存:支持缺页异常,内核空间静态映射到0-1GiB地址,用户空间映射到1-4GiB地址
- 内核通信:事件、信号量、互斥锁、队列
- 时间管理:软件定时器、系统时钟
**文件系统**
轻量级内核支持FAT,JFFS2,NFS,ramfs,procfs等众多文件系统,并对外提供完整的POSIX标准的操作接口,功能非常强大;内部使用VFS层作为统一的适配层框架,方便移植新的文件系统,各个文件系统也能自动利用VFS层提供的丰富的功能。
轻量级内核支持FAT,JFFS2,NFS,ramfs,procfs等众多文件系统,并对外提供完整的POSIX标准的操作接口;内部使用VFS层作为统一的适配层框架,方便移植新的文件系统,各个文件系统也能自动利用VFS层提供的丰富的功能。
主要特性有:
......@@ -92,6 +92,6 @@ OpenHarmony 轻量级内核是基于IoT领域轻量级物联网操作系统Huawe
- 动态链接:支持标准ELF链接执行、加载地址随机化
- 进程通信:支持轻量级LiteIPC,同时也支持标准的Mqueue、Pipe、Fifo、Signal等机制
- 系统调用:支持170+系统调用 ,同时有支持VDSO机制
- 系统调用:支持170+系统调用,同时有支持VDSO机制
- 权限管理:支持进程粒度的特权划分和管控,UGO三种权限配置
......@@ -86,7 +86,7 @@
<tr id="row357517134414"><td class="cellrowborder" valign="top" width="35.58%" headers="mcps1.2.3.1.1 "><p id="p12575676449"><a name="p12575676449"></a><a name="p12575676449"></a>LOS_INIT_LEVEL_KMOD_TASK</p>
</td>
<td class="cellrowborder" valign="top" width="64.42%" headers="mcps1.2.3.1.2 "><p id="p7128122619143"><a name="p7128122619143"></a><a name="p7128122619143"></a>内核任务创建</p>
<p id="p1657587184419"><a name="p1657587184419"></a><a name="p1657587184419"></a>说明:进行内核任务的创建(内核线程,软件定时器任务)</p>
<p id="p1657587184419"><a name="p1657587184419"></a><a name="p1657587184419"></a>说明:进行内核任务的创建(内核任务,软件定时器任务)</p>
<p id="p55485297219"><a name="p55485297219"></a><a name="p55485297219"></a>例如:资源回收系统常驻任务的创建、SystemInit任务创建、CPU占用率统计任务创建</p>
</td>
</tr>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册