为了使参与并发执行的每个程序(含数据)都能独立运行,在操作系统中必须为之配置一个专门的数据结构,成为进程控制块(Process Control Block,PCB)。系统利用PCB来描述进程的基本情况和活动过程,进而控制和管理进程。这样,由程序段、相关的数据段和PCB三部分便构成了进程实体(又称进程映像)。一般情况下,我们把进程实体就简称为进程,例如,所谓创建进程,实质上是创建进程实体中的PCB;而撤销进程,实质上是撤销进程的PCB,本教材中也是如此。
进程控制块的组织方式
1)线性方式
2)链接方式
3)索引方式
后来经过查找,发现
PCB只能是逻辑上的概念,真正对于进程的描述信息,是位于task_struct中的。
The Process Control Block is the collection of information needed to define a process. In modern OS’es processes are (more or less) isolated and run in their own memory space. The term process control block is not actually in use by any operating system and the various info needed to control a process is not actually stored in a signal structure, as such the term is not that helpful
In the kernel, the process descriptor is a structure called task_struct, which keeps track of process attributes and information. All kernel information regarding a process is found there.
The thread_info and task_struct structures are just two different structures that hold different pieces of information about a thread, with the thread info holding more architecture-specific data than the task_struct. It makes more sense to split up the information rather than keep it all in the same structure (Although you could put them in the same struct, the 2.4 Linux kernel did this ).