Windows 内存体系结构

2018-08-22  本文已影响0人  szn好色仙人

虚拟地址空间的分区



空指针赋值分区
用户模式分区
在Windows x86 下得到更大的用户模式分区
  • 打开 /LARGEADDRESSAWARE开关,VS2010中设置的方式为:项目->属性->链接器->系统->启用大地址(32位程序打开此开关,运行在64位系统下时,可获取接近4GB的用户模式分区)
  • 设置3GB开关:在cmd中执行 bcdedit /set IncreaseUserVa 3072 然后再打开进程的 /LARGEADDRESSAWARE 开关,则对应进程可多访问1GB的用户虚拟地址空间
    bcdedit /enum 查看当前BCD各参数设置 bcdedit /deletevalue IncreaseUserVa 取消对于IncreaseUserVa的设置
  • https://support.microsoft.com/en-us/help/294418/comparison-of-32-bit-and-64-bit-memory-architecture-for-64-bit-edition
内核模式分区

地址空间中的区域

地址空间的预定、调拨、释放
物理存储器与页交换文件
页面保护属性
页面状态
State Description
Free The page is neither committed nor reserved. The page is not accessible to the process. It is available to be reserved, committed, or simultaneously(同时) reserved and committed. Attempting to read from or write to a free page results in an access violation(违反) exception.
A process can use the VirtualFree or VirtualFreeEx function to release reserved or committed pages of its address space, returning them to the free state.
Reserved The page has been reserved for future use. The range of addresses cannot be used by other allocation functions. The page is not accessible and has no physical storage associated with it. It is available to be committed.
A process can use the VirtualAlloc or VirtualAllocEx function to reserve pages of its address space and later to commit the reserved pages. It can use VirtualFree or VirtualFreeEx to decommit committed pages and return them to the reserved state.
Committed Memory charges have been allocated from the overall(全部) size of RAM and paging files on disk. The page is accessible and access is controlled by one of the memory protection constants. The system initializes and loads each committed page into physical memory only during the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages.
A process can use VirtualAlloc or VirtualAllocEx to commit physical pages from a reserved region. They can also simultaneously reserve and commit pages.
The GlobalAlloc and LocalAlloc functions allocate committed pages with read/write access.
上一篇 下一篇

猜你喜欢

热点阅读