From: Carl Daniel [VC++ MVP] on 13 Feb 2006 10:20 Jeffrey wrote: > Hi Carl, > > Yes, i'm calling AllocateUserPhysicalPages (which is successful) and > then calling VirtualAlloc (which fails). After VirtualAlloc I would > then call MapUserPhysicalPages. So my cycles goes (see code below): To add to Ivan's response - AWE increases the amount of physical memory that can be mapped into your address space, but does not increase your virtual address space at all. The expectiation is that if you're using AWE, you're doing to the work to manage swapping several blocks of physical memory into one or more windows of virtual address space, using MapUserPhysicalPages. That's why AWE makes sense for something like SQL server which can use it for a large in-memory page cache. Note that when using AWE you can't effectively use normal C pointers to refer to address in your AWE pages. Instead, you have to store some kind of a structure with a page reference and an offset into that page, and manage swapping of the pages yourself when you need to access a page. Naturally, you'll need appropriate locking to coordinate access if you're using multiple threads. If your memory needs cannot be "chunked" into large blocks with relatively few switches between blocks, then AWE really isn't going to help you. -cd
From: Jeffrey on 16 Feb 2006 16:56
Thank you very much for your responses. I wish this was in the AWE documentation somewhere in plain language. Wehn I was researching this and PAEX86 initially I thought it would solve all my problems. Now I see it is a bit more complex. Carl Daniel [VC++ MVP] wrote: > Jeffrey wrote: > >>Hi Carl, >> >>Yes, i'm calling AllocateUserPhysicalPages (which is successful) and >>then calling VirtualAlloc (which fails). After VirtualAlloc I would >>then call MapUserPhysicalPages. So my cycles goes (see code below): > > > To add to Ivan's response - > > AWE increases the amount of physical memory that can be mapped into your > address space, but does not increase your virtual address space at all. > The expectiation is that if you're using AWE, you're doing to the work to > manage swapping several blocks of physical memory into one or more windows > of virtual address space, using MapUserPhysicalPages. That's why AWE makes > sense for something like SQL server which can use it for a large in-memory > page cache. > > Note that when using AWE you can't effectively use normal C pointers to > refer to address in your AWE pages. Instead, you have to store some kind of > a structure with a page reference and an offset into that page, and manage > swapping of the pages yourself when you need to access a page. Naturally, > you'll need appropriate locking to coordinate access if you're using > multiple threads. If your memory needs cannot be "chunked" into large > blocks with relatively few switches between blocks, then AWE really isn't > going to help you. > > -cd > > |