首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> 专家专栏 >> Symbian翻译小组 >> Symbian OS SDK V8.1a >> Symbian OS guide >> Base >> Using User Library >> Memory Management >> concepts >> 正文
虚拟机模型
作者:LeeFj    文章来源:http://www.nbszyy.com.cn/blog/default.asp    更新时间:2005-12-9 10:54:03


                  Symbian sdk帮助-虚拟机模型
               译文作者: Leefj
  译文版本:1.0   译文时间:2005-12-9

 

Virtual machine model

虚拟机模型

The Kernel provides a 'virtual machine' environment to user processes. Each process accesses its data in the same virtual address range, called the data section, which ranges from:

内核对用户进程提供了一个虚拟机。每个进程在访问自身数据的时候使用同样的虚地址范围,这个虚地址范围被称为数据区(data Section)。这个数据区的地址从0x00400000 到 0x3FFFFFFF

 

 

0x00400000 to 0x3FFFFFFF

but note that the static data always appears at:

但是,注意,静态数据通常在0x00400000出现。

 

 

0x00400000

The code chunk for RAM loaded processes always appears at:

RAM用于加载进程的code chunk通常在 0x20000000 出现。

 

0x20000000

This allows multiple processes to run, each executing the same code (e.g. multiple word documents open at the same time, each in a separate instance of the word application) where the same code chunk is used for each of the processes. This reduces RAM usage.

这就允许了多进程的运行,每一个进程执行同样的代码(也就是说,多个word文档可以同时打开,且每一个都在独立的word应用程序实例中),一个code chunk将被多个进程所使用。这样可以减少RAM的使用。

 

In effect, each user process has the same kind of view. Code instructions address data using the virtual address; the Memory Management Unit (MMU) is responsible for the translation of the virtual address to the physical RAM address.

从运行效率考虑,每一个进程拥有相同类型的视图。代码指令使用了虚拟的地址;内存管理单元(MMU)负责把虚地址转换成实际的物理RAM地址。

 

 

Only one chunk can occupy a given virtual address range at a time, so a context switch between different processes involves re-mapping the chunks. The process chunks of the old process are re-mapped to their home addresses. These are in the home section, which is the virtual address range from:

在同一时间只有一个chunk可以占据虚地址空间。这样在不同的进程间进行上下问切换时,必须对chunk地址进行重新映射。原先运行的进程将被重新映射到原驻地址(home address),原驻地址位于原驻区(home section),它的虚地址范围从0x80000000 到 0xFFFFFFFF。

 

 

0x80000000 to 0xFFFFFFFF

ROM code is normally mapped into the address range:

ROM代码通常被映射到 0x50000000 - 0x5FFFFFFF 这个地址范围。

 

0x50000000 to 0x5FFFFFFF

 

The process chunks of the new process are mapped from their home addresses back to the data section. Chunks which are not accessible by the current user process reside in the home section, and they have supervisor mode only access permissions, so that only the kernel can access them.

将要被运行的进程的进程块(process chunk),从原驻地址被映射到数据区。Chunks 被映射回原驻区后不可以被当前用户进程访问,它们唯一许可超级用户模式的访问,这个时候只有内核才可以访问他们。

 

The Kernel's data and stack/heap chunks also reside in the home section. These are never visible to user processes. Code chunks for RAM-loaded libraries reside at the top end of the home section and have user read-only access, so that all user processes can execute code from a loaded library.

内核的数据,以及 stack/heap chunks 也位于原驻区。他们对于用户进程是不可见的。用于加载库的 Code chunks 位于原驻区顶端,并且仅允许用户级进程只读访问,所以所有的用户进程可以执行已经加载好的库代码。

 

A context switch between processes thus involves:

进程间的上下文切换包括以下一些步骤:

 

 

moving the old process chunks to the home section, and changing their access permissions to supervisor-only

把原先运行的进程移至原驻区,并修改它们的访问许可为仅超级用户。

 

moving the new process chunks to the data section and changing their access permissions back to user-accessible.

把将要运行的进程chunk移到数据区,并修改它们的访问许可为用户可访问。

 

This is best seen graphically. In the first diagram shown below, user-process 1 is running and can 'see' all chunks in the clear boxes. Those boxes with dark background represent chunks which are not visible to user-process 1.

在下面的第一幅图中,user-process 1 正在运行,并且它所有的chunk都是可见的。那些使用黑色背景的方块表示那些对于user-process 1 不可见的chunk。

 

When user-process 2 is running, the context switch re-maps the user-process 2 data to the data section and user process 1 data is re-mapped to the home section as the second diagram shows.

当 user-process 2 运行的时候(图2),user-process 2 的数据被重新映射到数据区,而user-process 1 的数据被映射到原驻区。

 

 

User process 1's view.

 

 

 

User process 2's view.

 

 

 

 

相关文章:
在P800/P910中找回已拨打号码
利用 RSocket::Read() 函数读取给定数据的字节数
编程IrComm3 原始通信
线程与进程的优先级
固化进程
进程与线程简介
线程和进程 ID
进程类型
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号