Question for keeping pages in the RAM?

08/02/2004 - 11:49 por Frank | Informe spam
Hi,folks

I am a beginner, I wanna allocate a number of pages of space for some
operations, and I need keeping those pages stay in the RAM at all for
operating faster.Is there WIN32 API can do it? Any reply is appreciated :p

Thanx very very ... much!

Frank F.Han

+--+
| winsays@:-)hotmail:-).com |
+--+

Preguntas similare

Leer las respuestas

#1 Tim Robinson
08/02/2004 - 12:16 | Informe spam
You can call VirtualLock to ask Windows to try to keep certain pages in
physical memory. But, as always, the kernel knows best, and it can still
page out your memory.

Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Frank" wrote in message
news:
Hi,folks

I am a beginner, I wanna allocate a number of pages of space for some
operations, and I need keeping those pages stay in the RAM at all for
operating faster.Is there WIN32 API can do it? Any reply is appreciated :p

Thanx very very ... much!

Frank F.Han

+--+
| winsays@:-)hotmail:-).com |
+--+


Respuesta Responder a este mensaje
#2 Frank
08/02/2004 - 13:17 | Informe spam
Thanx Tim :p

Actually those pages are allocated to be cache of my IO operation on disk
file, you know, doing that could discard *.tmp file and improve speed for
disk file IO. But I dont know how many number of bytes is appropriate to
set. Could u give any suggests? Thanx :p


"Tim Robinson" дÈëÏûÏ¢ÐÂÎÅ
:c055q8$12vcso$
You can call VirtualLock to ask Windows to try to keep certain pages in
physical memory. But, as always, the kernel knows best, and it can still
page out your memory.

Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Frank" wrote in message
news:
> Hi,folks
>
> I am a beginner, I wanna allocate a number of pages of space for some
> operations, and I need keeping those pages stay in the RAM at all for
> operating faster.Is there WIN32 API can do it? Any reply is appreciated


:p
>
> Thanx very very ... much!
>
> Frank F.Han
>
> +--+
> | winsays@:-)hotmail:-).com |
> +--+
>
>


Respuesta Responder a este mensaje
#3 Tim Robinson
08/02/2004 - 23:34 | Informe spam
Remember that Windows does caching for you, so you can call ReadFile and
WriteFile and be confident that it's doing its best to make efficient usage
of the memory available. Or, to avoid the overhead of ReadFile/WriteFile
calls, use a memory-mapped file: this gives you direct access to the cache,
and lets you read and write a file as if it were normal memory. In either
case, Windows will tweak the amount of cache memory to be (hopefully)
optimal.

Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Frank" wrote in message
news:
Thanx Tim :p

Actually those pages are allocated to be cache of my IO operation on disk
file, you know, doing that could discard *.tmp file and improve speed for
disk file IO. But I dont know how many number of bytes is appropriate to
set. Could u give any suggests? Thanx :p


"Tim Robinson" дÈëÏûÏ¢ÐÂÎÅ
:c055q8$12vcso$
> You can call VirtualLock to ask Windows to try to keep certain pages in
> physical memory. But, as always, the kernel knows best, and it can still
> page out your memory.
>
> Tim Robinson (MVP, Windows SDK)
> http://www.themobius.co.uk/
>
> "Frank" wrote in message
> news:
> > Hi,folks
> >
> > I am a beginner, I wanna allocate a number of pages of space for some
> > operations, and I need keeping those pages stay in the RAM at all for
> > operating faster.Is there WIN32 API can do it? Any reply is


appreciated
:p
> >
> > Thanx very very ... much!
> >
> > Frank F.Han
> >
> > +--+
> > | winsays@:-)hotmail:-).com |
> > +--+
> >
> >
>
>


Respuesta Responder a este mensaje
#4 Alexander Grigoriev
09/02/2004 - 02:18 | Informe spam
When working with huge files, Windows cache tends to grow uncontrollably at
the cost of application memory. It's definitely not suited for such a case.
And there is no way to limit such cache bloat (there was in Windows 9x).

"Tim Robinson" wrote in message
news:c06dib$13h862$
Remember that Windows does caching for you, so you can call ReadFile and
WriteFile and be confident that it's doing its best to make efficient


usage
of the memory available. Or, to avoid the overhead of ReadFile/WriteFile
calls, use a memory-mapped file: this gives you direct access to the


cache,
and lets you read and write a file as if it were normal memory. In either
case, Windows will tweak the amount of cache memory to be (hopefully)
optimal.

Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Frank" wrote in message
news:
> Thanx Tim :p
>
> Actually those pages are allocated to be cache of my IO operation on


disk
> file, you know, doing that could discard *.tmp file and improve speed


for
> disk file IO. But I dont know how many number of bytes is appropriate to
> set. Could u give any suggests? Thanx :p
>
>
> "Tim Robinson" дÈëÏûÏ¢ÐÂÎÅ
> :c055q8$12vcso$
> > You can call VirtualLock to ask Windows to try to keep certain pages


in
> > physical memory. But, as always, the kernel knows best, and it can


still
> > page out your memory.
> >
> > Tim Robinson (MVP, Windows SDK)
> > http://www.themobius.co.uk/
> >
> > "Frank" wrote in message
> > news:
> > > Hi,folks
> > >
> > > I am a beginner, I wanna allocate a number of pages of space for


some
> > > operations, and I need keeping those pages stay in the RAM at all


for
> > > operating faster.Is there WIN32 API can do it? Any reply is
appreciated
> :p
> > >
> > > Thanx very very ... much!
> > >
> > > Frank F.Han
> > >
> > > +--+
> > > | winsays@:-)hotmail:-).com |
> > > +--+
> > >
> > >
> >
> >
>
>


Respuesta Responder a este mensaje
#5 Frank
09/02/2004 - 02:27 | Informe spam
hi,Tim
I got it. And, I have another question need consulting you. Just as I
mentioned in my first and 2nd threads, I need allocating space for
processing data and then writing portion of them into disk file. So it is
another caching issue. I dont know hom many numbers of bytes for allocating
which to be data cache for some common processes (not file IO here). That
cache need at least 8kb space. You know, as my thinking that allocate more
space which is greater than 8kb could reduse times of IO and therefore
improve speed. Does my thinking is right? Give me some advice, very Thanx.

"Tim Robinson" дÈëÏûÏ¢ÐÂÎÅ
:c06dib$13h862$
Remember that Windows does caching for you, so you can call ReadFile and
WriteFile and be confident that it's doing its best to make efficient


usage
of the memory available. Or, to avoid the overhead of ReadFile/WriteFile
calls, use a memory-mapped file: this gives you direct access to the


cache,
and lets you read and write a file as if it were normal memory. In either
case, Windows will tweak the amount of cache memory to be (hopefully)
optimal.

Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/

"Frank" wrote in message
news:
> Thanx Tim :p
>
> Actually those pages are allocated to be cache of my IO operation on


disk
> file, you know, doing that could discard *.tmp file and improve speed


for
> disk file IO. But I dont know how many number of bytes is appropriate to
> set. Could u give any suggests? Thanx :p
>
>
> "Tim Robinson" дÈëÏûÏ¢ÐÂÎÅ
> :c055q8$12vcso$
> > You can call VirtualLock to ask Windows to try to keep certain pages


in
> > physical memory. But, as always, the kernel knows best, and it can


still
> > page out your memory.
> >
> > Tim Robinson (MVP, Windows SDK)
> > http://www.themobius.co.uk/
> >
> > "Frank" wrote in message
> > news:
> > > Hi,folks
> > >
> > > I am a beginner, I wanna allocate a number of pages of space for


some
> > > operations, and I need keeping those pages stay in the RAM at all


for
> > > operating faster.Is there WIN32 API can do it? Any reply is
appreciated
> :p
> > >
> > > Thanx very very ... much!
> > >
> > > Frank F.Han
> > >
> > > +--+
> > > | winsays@:-)hotmail:-).com |
> > > +--+
> > >
> > >
> >
> >
>
>


Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaSiguiente Respuesta Tengo una respuesta
Search Busqueda sugerida