Re: Performance problem with UnmapViewOfFile() in Vista and XP x64



As far as I know, no further changes are planned in this area
for SP1.

The behavior you're seeing is considered to be by design.
When you unmap a view, pages from the view are removed
from your working set and placed onto the modified page list
(assuming they are not part of any other working set). At this
point the memory manager may begin flushing them to disk.
There is no mechanism by which an application can tell the
system that some of the modified pages shouldn't be written
out because they will soon be referenced back into the
working set.

So even on XP you will get some paging IO in this case
(you can see it by monitoring Memory\Pages Output/sec
counter in perfmon). When the number of modified pages
is low you may not see any paging IOs. As it gets higher,
XP will try to write out about 100 pages every second.
Finally, when available pages (free+zeroed+standby) drop
below about 1000, the modified page writer on XP will
start writing as fast as it can.

Vista has several changes in this area. When the number of
modified pagefile pages is low it should actually write less
often than XP (this helps battery life on laptops). However,
Vista also switches to the "continuous write" mode sooner
than XP, to prevent problems when misbehaving applications
fill entire memory with dirty pages. In LH/Vista SP1 the
thresholds have been somewhat relaxed compared to
Vista RTM but they are unlikely to go back to XP levels.

I can't think of a good solution to this. On 64 bit the address
space is large enough so that you can keep everything in
the working set as long as there is enough physical memory
to back it. On 32 bit however you can have more RAM than
VM space, so unmapping becomes necessary. You could
use multiple processes to hold portions of the entire region
in their working sets, but that will likely require significant
design changes and may not be a feasible solution.

If you are not actually sharing the memory among multiple
processes (in effect, using a pagefile backed section as a
cache for a single process) then you might be able to use
AWE memory instead.

Finally, you could also write a driver to lock your shared
pages in memory so they are never paged out even if you
unmap them. This is rather ugly but might help if you have
no other options.

--
This posting is provided "AS IS" with no warranties, and confers no
rights.

"chaboud" wrote:

I tried this with the LH Feb '07 CTP, and that did not correct the problem.
If this is roughly the state that the kernel will be in for Vista SP1,
we'll
have to find a workaround, feature limitation for Vista, or, at the very
least, warn our users about the issue.

In the context in which we use this technique (an HD video editor) we can
see a significant performance loss, from 20fps playback in XP 32 to 5fps
in
Vista 32 on the same hardware. Because of virtual-address-space
size-limits
and fragmentation, it is not possible to avoid unmapping without severely
limiting the amount of usable memory for these buffers. Limiting this
cache
size would lead to a performance/usability limitation, so any such change
would have to be restricted to Vista.

We'd very much like to find a clean resolution to this if at all possible.


.



Relevant Pages

  • Re: Memory error PP2003 and Vista
    ... No answer, but I'm running Vista Business SP1 with Project 2007, 2003, Office 2007 and 2003 with no problems. ... memory issue, I doubt that anyone would be able to use Project successfully ... Process" and after several repeated passes crashes with the "not ...
    (microsoft.public.project)
  • Re: IE 6
    ... [We heard you the first time and you're still NOT running IE6 in Vista SP1.] ... Kenny - MCP,MCDST,MCSA wrote: ... memory could not be "read". ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: OT: Vista Licence
    ... it since SP1. ... So what EXACTLY is the problem with Vista. ... its great (assuming you have adequate memory). ... while using very little CPU time. ...
    (uk.comp.homebuilt)
  • Re: Event Viewer - "unexpected shutdowns"
    ... be advised I ran the 'repair' options within the last two weeks a few times by booting from the Vista CD. ... The memory diagnostic tool ran cleanly - as reported during the test and after the reboot - nothing to report. ... The attempted chkdsk from the command prompt reported that I did not have the privilege & advised I had to run in 'elevated mode' - I had never heard or read such a term & have been a PC enthusiast since Windows 3.0 from 1990. ... PS - I should add that upon rebooting after an unexpected shutdown - Vista asks if Safe Mode is desired during rebooting. ...
    (microsoft.public.windows.vista.general)
  • Re: Event Viewer - "unexpected shutdowns"
    ... be advised I ran the 'repair' options within the last two weeks a few times by booting from the Vista CD. ... The memory diagnostic tool ran cleanly - as reported during the test and after the reboot - nothing to report. ... The attempted chkdsk from the command prompt reported that I did not have the privilege & advised I had to run in 'elevated mode' - I had never heard or read such a term & have been a PC enthusiast since Windows 3.0 from 1990. ... PS - I should add that upon rebooting after an unexpected shutdown - Vista asks if Safe Mode is desired during rebooting. ...
    (microsoft.public.windows.vista.general)