进程和进程映像有什么区别?

What's the difference between a process and a process image?

进程和进程映像有什么区别?

一个包含而另一个不包含的是什么?有哪些区别组件?

这一切都在内存中的进程控制结构和进程位置的上下文中。

据我了解,进程映像是在执行前为其分配内存时拍摄的进程映像。发生这种情况是因为,在多任务处理时,内核需要 re-enter 它停止的进程。如果在执行过程中更改进程,可能会发生不好的事情,因此操作系统会制作一个 read-only 版本的进程并在执行期间使用它。

Here's a webpage with more details on process images

当一个程序作为一个进程加载时,它会被分配一段虚拟内存,形成它的可用地址space。在此过程映像中,通常至少有四个元素:

程序代码(或文字)

The program instructions to be executed. Note that it is not necessary for the processor to read the totality of a process into physical memory when a program is run, instead by a procedure known as ?dynamic paging? the next block of instructions is loaded as required and may be shared between processes.

程序数据

May be distinguished as initialised variables including external global and static variables, uninitialised variables (known as a bss area on Unix derivative systems). Data blocks are not shared between processes by default.

堆栈

A process will commonly have at least two last-in, first-out (LIFO) stacks, including a user stack for user mode and a kernel stack for kernel mode.

进程控制块

Information needed by the operating system to control the process.

Source

一个过程涉及的不仅仅是它的形象。它是一个活生生变化的图像因此得名,即运行由CPU。
单个进程可以有多个不同间隔的图像,以及它对未直接包含在图像中的 CPU 的影响,如算术运算。

进程只是运行程序的抽象。在进程控制结构的上下文中,当进程被引用时,通常意味着进程控制块。

控制结构的概括:OS 通过系统内存中的进程 table/list 跟踪所有进程。它看起来像这样:

Process 1
Process 2
...
Process n

这些列表项中的每一个都是一个过程图像。每个过程映像依次(通常)包含:

  1. 用户数据(用户程序、用户栈、堆)
  2. 进程控制块(进程id、状态信息、进程控制信息)

这样,过程映像就是PCB多

总而言之,OS 保存了一个过程映像列表,其中包含过程控制块和与用户程序相关的所有数据。