Hi Konstantin,
This is creepy. But as I understood from link below it that it will only
happen if whole process is paged out. (This will never happen). And that
would be critical if we really used physical memory for let say DMA
transfers.
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=Xns92065
1D88F248JochenKalmbachholzma%40127.0.0.1&rnum=1&prev=/groups%3Fq%3DQ94996%26
hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DXns920651D88F248JochenKal
mbachholzma%2540127.0.0.1%26rnum%3D1
Regards,
Slobodan
KM said:
Slobodan,
To be frankly, there is an information on VirtualLock in MSDN that is
a
bit conflicting to another MSDN articles.
In the VirtualLock API description it says that the pages are
*absolutely*
locked into physical memory.
However, in the Article Q94996 (it was written for NT 3.1-4.0 but my
guess
it should still apply to 2000/XP as the API didn't change
much) it says the following:
-------------------------------------------------------------------------- set
(virtual memory); it does not lock them absolutely into
physical memory. VirtualLock() essentially means "this page is always
part
of the process's working set."
The system is free to swap out any virtually locked pages if it swaps
out
the whole process. And when the system swaps the process
back in, the virtually locked pages (similar to any virtual pages) may
end
up residing in different real pages.
It is wise to use VirtualLock() very sparingly because it reduces the flexibility of the system.
Depending upon memory demands on the system, the memory manager may
vary
the number of pages a process can lock. Under typical
conditions you can expect to be able to VirtualLock() approximately 28
to
32 pages.
In Windows NT 3.5, you can use SetProcessWorkingSetSize() to increase
the
size of the working set, and therefore increase the number
of pages that VirtualLock() can lock.
-------------------------------------------------------------------------- 6.0
old MSDN archive saved locally (sometimes it helps

).
Probably, the answer would be in experimenting with the API:
allocating a
big chunk of memory, loading up the system with various
apps and querying the number of pages committed.
Or MS which have the access to the source code of VirtualLock may easy answer the question.
--
KM,
BSquare Corporation
Hi Konstantin,
I said similar approach to VirtualLock, so I have not given any details
(VirtualLock is described very well in SDK).
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base
/virtuallock.asp
Sometimes it may be a good idea to call SetProcessWorkingSetSize
API
in
conjunction with VirtualLock to increase the upper and lower
limits of the particular process's working set.
I agree that this is what should be done. (Unless he will use user account
or small amount of memory like 4096 bytes.)
VirtualLock() only locks pages into the process working set, it
does
not
lock them
absolutely into physical memory.
Are you sure? If you are, then my English is much worse than I
thought
:'(
Quote:
The VirtualLock function locks the specified region of the process's virtual
address space into physical memory, ensuring that subsequent access
to
the
region will not incur a page fault.
Pages that a process has locked remain in physical memory until the process
unlocks them or terminates.
What do you think?
Slobodan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have an opinion on the effectiveness of Microsoft Embedded
newsgroups?
Tell
Microsoft!
https://www.windowsembeddedeval.com/community/newsgroups
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Just to add to Slobodan's detail message...
VirtualLock() only locks pages into the process working set, it
does
not
lock them
absolutely into physical memory. The API may fail it the working
set
is
not enough to fit your app memory requests.
--
KM,
BSquare Corporation
First I would read and use:
http://msdn.microsoft.com/embedded/community/tips/xp/renamert/default.aspx
Then file mapping (if you don't write anything to disk won't affect
EWF).
If you are writing to disk then it will use EWF.
You are using file mapping in memory only, right?
So you should move page file to unprotected partition and you
will
be ok
regarding EWF but your problem remains, so:
1. You have plenty of RAM solution would be to disable page
file,
and to
use
RAM EWF. This will guaranty you that HDD will be accessed only
for
read
requests not for write.
2. You can always use approach similar to VirtualLock function
that
will
guarantee to you that this memory will be never swapped.
Regards,
Slobodan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Tell
Microsoft!
https://www.windowsembeddedeval.com/community/newsgroups
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What are the ramifications of using Win32 File Mapping on XPE with
disk-based EWF? I am not concerned about saving the data between
bootups
at
all -- it would just be used for data sharing among multiple
processes.
However, I don't want the data to actually be paged out to the disk
since
I'm trying to avoid disk activity (the disk should normally
stay
spun
down
via power savings settings). I would probably just create the mapped
section
directly in the system page file.
Am I right in that, if nothing else causes a need for paging, the
mapped
section will just be updated in RAM without the changes being flushed
out
to
the disk? IIRC from the theory of virtual memory operations, paging
should
only occur if the physical memory used by the section has to be
swapped
for
some other set of pages, and in our app with plenty of RAM
this
should
never
happen. Anyone say otherwise?
Doug