> For the complete documentation index, see [llms.txt](https://lfool.gitbook.io/operating-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lfool.gitbook.io/operating-system/di-er-zhang-jin-cheng-guan-li/1.-jin-cheng-de-gai-nian-zu-cheng-te-zheng.md).

# 1. 进程的概念 & 组成 & 特征

![](/files/-MEvu6rb9FUDJUaMtFGU)

## 1. 进程的概念

**程序：**&#x662F;**静态的**，是存放在磁盘里的可执行文件，是一系列的指令集合。

**进程（Process）：**&#x662F;**动态的**，是程序一次执行过程。同一个程序可能有多个进程。

进程的基本描述信息全部存放在一个数据结构 **PCB**（Process Control Block）中，即**进程控制块**。操作系统需要对各个并发运行的进程进行管理，**但凡管理时所需要的信息，都会被放在 PCB 中**。

## 2. 进程的组成

### 2.1 PCB

操作系统对**进程管理工作所需的信息都存放在 PCB 中**

**PCB 是进程存在的唯一标志**，当进程被创建时，操作系统为其创建 PCB，当进程结束时，会回收其 PCB

**PCB 包含的信息：**

* **进程描述信息**
  * 进程标识符 **PID**
  * 用户标识符 **UID**
* **进程控制和管理信息**
  * CPU、磁盘、网络流量使用情况统计......
  * **进程当前状态**：就绪态/阻塞态/运行态......
* **资源分配清单**
  * 正在使用哪些**文件**
  * 正在使用哪些**内存区域**
  * 正在使用哪些 **I/O 设备**
* **处理机相关信息**
  * 如 PSW、PC 等等各种寄存器的值（用于实现进程切换）

### 2.2 程序段、数据段

**程序段：**&#x7A0B;序的代码（指令序列）

**数据段：**&#x8FD0;行过程中产生的各种数据（如：程序中定义的变量）

**PCB** 是**给操作系统用的**；**程序段、数据段**是**给进程自己用的**

### 2.3 程序运行过程

![](/files/-MEvqro8oDpqBT3-Fvh6)

进程 & 进程实体的**区别**：

* 进程是进程实体的运行过程
* 进程实体是进程运行过程中的一次快照

一个进程实体（进程映像）由 PCB、程序段、数据的组成。进程是**动态的**，进程实体（进程映像）是**静态的**。

**进程**是系统进行**资源分配**的单位，**线程**是系统**调度**的单位。

## 3. 进程的特征

* **动态性**
  * 进程是程序一次执行过程，是动态产生、变化和消亡的
* **并发性**
  * 内存中有多个进程实体，各个进程可并发执行
* **独立性**
  * 进程是能独立运行、独立获取资源的基本单位
* **异步性**
  * 各个进程按各自独立的、不可预知的速度向前推进，操作系统要提供“进程同步机制”来解决异步问题
* **结构性**
  * 每个进程都会配置一个 PCB。结构上看，进程由程序段、数据的、PCB 组成


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lfool.gitbook.io/operating-system/di-er-zhang-jin-cheng-guan-li/1.-jin-cheng-de-gai-nian-zu-cheng-te-zheng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
