5

我理解“进程”概念的方式是它是可执行程序的运行实例。exe 在辅助内存中,它的运行实例在 RAM 中。如果这种理解是正确的,我想知道这个抽象描述的真正含义是什么:'将进程划分为'页面'并在RAM中运行一些页面并将其余页面保存在辅助内存中以便在需要时进行交换'?这里的问题是在虚拟内存的上下文中。

根据主持人的建议,在问题中添加“编程”上下文:

假设我编写了一个小程序来列出从 1 到 100 的数字(或)以打印“Hello world”(或)一些桌面实用程序来扫描文本文件并在桌面窗口中逐个打印文件中的单词。考虑到我拥有的最终可执行文件,一旦这些程序被编译和链接,当我运行可执行文件时,如何将可执行文件“划分”并在 RAM 中部分运行?我该如何把握和想象在某个时间点 RAM 中“应该”什么以及“不应该”的概念?

4

1 回答 1

0

You have it (the division) right there, in the virtual to physical address translation. The virtual address space is split into blocks of one or several kilobytes (typically, all of the same size), each of which can be associated with a chunk (page) of physical memory of the same size.

Those parts of the executable (or process) that haven't been used yet or haven't been used recently need not to be copied into the physical memory from the disk and so the respective portions of the virtual address space may not be associated with physical memory either. When the system becomes low on free physical memory, it may repurpose some pages, saving their contents to the disk if necessary (or not saving, if they contain read-only data/code).

于 2013-02-17T08:53:12.487 回答