wince5.0 Memory Architecture

本文详细介绍了Microsoft Windows CE操作系统中的内存管理方式,包括ROM中存储的内容、程序如何从ROM执行节省RAM空间、不同类型的程序如何加载到RAM以及RAM区域的划分等内容。此外还探讨了在低内存条件下系统如何调整内存分配。

wince5.0 Memory ArchitectureIn any Microsoft® Windows® CE–based device, ROM stores the entire operating system (OS), as well as the applications that come with the OS design.

If a module is not compressed, the OS executes the ROM-based modules in place. If the OS compresses a ROM-based module, it decompresses the module and pages it into RAM. The OS loads all read/write data into RAM. The OEM controls the option to enable compression in ROM.

When the OS executes programs directly from ROM, it saves program RAM and reduces the time needed to start an application, because the OS does not have to copy the program into RAM before launching it.

For programs contained in the object store or on a flash memory storage card, the OS does not execute these in place if the programs are not in ROM. Instead, the OS pages these programs into the RAM and then executes them.

Depending on the OEM and the driver options on a specific Windows CE–based device, the program module can be paged on demand. The OS can bring in one page at a time or load the entire module into ROM at once.

The RAM on a Windows CE–based device is divided into two areas: the object store and the program memory.

  • The object store resembles a permanent, virtual RAM disk. Data in the object store is retained when you suspend or perform a soft reset operation on the system. Devices typically have a backup power supply for the RAM to preserve data if the main power supply is interrupted temporarily. When operation resumes, the system looks for a previously created object store in RAM and uses it, if one is found. Devices that do not have battery-backed RAM can use the hive-based registry to preserve data during multiple boot processes.
  • The program memory consists of the remaining RAM. Program memory works like the RAM in personal computers — it stores the heaps and stacks for the applications that are running.

The maximum size for the RAM file system is 256 MB, with a maximum size of 32 MB for a single file. However, a database-volume file has a 16-MB limit. The maximum number of objects in the object store is 4,000,000.

The boundary between the object store and the program RAM is movable. In Control Panel, a user can modify the system settings to move the boundary, if the OS design provides this option.

Under low-memory conditions on some Windows CE–based devices, the OS might prompt the user for permission to take some object store RAM for use as program RAM to meet the RAM requirements of an application.

When Windows CE OS starts, it creates a single 4-gigabyte (GB) virtual address space. The address space is divided into 33 slots, and each slot is 32 megabytes (MB). All the processes share the address space. When a process starts, Windows CE selects an open slot for the process in the address space of the system. Slot zero is reserved for the currently running process.

Additionally, Windows CE creates a stack for the thread and a heap for the process. Each stack has an initial size of at least 1 kilobyte (KB) or 4 KB, which is committed on demand.

The amount of stack space that is reserved by the system, on a per-process basis, is specified in the /STACK option for the linker.

Because the stack size is CPU-dependent, the system on some devices allocates 4 KB for each stack.

The maximum number of threads is dependent on the amount of available memory. You can allocate additional memory, outside of the 32 MB that is assigned to each slot, by using memory-mapped files or by calling the VirtualAlloc function.

The following illustration shows how memory is allocated in the Windows CE address space.

 

 

When a process initializes, the OS maps the following DLLs and memory components:

  • Some execute-in-place (XIP) dynamic-link libraries (DLLs)
  • Some read/write sections of other XIP DLLs
  • All non-XIP DLLs
  • Stack
  • Heap
  • Data section for each process in the slot assigned to the process

DLLs and ROM DLL read/write sections are loaded at the top of the slot. DLLs are controlled by the loader, which loads all the DLLs at the same address for each process. The stack, the heap, and the executable (.exe) file are created and mapped from the bottom up. The bottom 64 KB of memory always remains free.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值