🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10227

Re: MouseHook,Message From DLL to Application while not on Focus

#10227
From: Alan Bellingham
Date: Thu, 06 May 2004 10:59
54 lines
3332 bytes
"Alex Sarafian" <demelene_gr@yahoo.gr> wrote:

>When Creating a shared memory in a actual file in HD or in the page file
>(which is actually the same) isn't there a misusage of resources.
>isn't there a way to create to shared memory block in physical memory and
>just access it?

No - but don't worry.

To be simplistic:

Under NT (including Windows 2000 and XP), all memory is ultimately disk.
Your apparent RAM is space in the page file. The underlying virtual
memory manager maps memory addresses onto that disk space.

(I seem to recall an early presentation from MS which stated that the
theoretical physical RAM requirement for NT was something like 12K -
three 4k pages - and two of those pages were for the VM memory manager
itself.)

Of course, without infinitely fast hard drives, that would be unusable.
So the VM caches that disk in real physical RAM (whose _real_ memory
address is supposedly unknowable). Also, the code is also mapped into
memory.

Code - which is unchangeable - may have the same disk blocks mapped into
the address space of multiple program instances. These blocks are RAM
cached, but dropped when physical memory gets tight. When required
again, they get reloaded.

Data - which is changeable - will have different disk blocks mapped for
different instances. The blocks are RAM cached. When physical memory
gets tight, they get flushed out to disk and dropped. When required
again, they get reloaded.

_Shared_ data - which you want - maps as if code. The same disk blocks
map into the address space of different program instances. The blocks
are RAM cached. When physical memory gets tight, they get flushed out to
disk and dropped. When required again, they get reloaded.

So although the memory is disk mapped, it will probably (almost
certainly) be in RAM anyway.

This also explains why you don't see a disk cache program anymore - the
entire OS is running on top of it. It's also why RAM drives have
effectively disappeared - they'd be on disk anyway.

You _may_ be able to do what you were asking by talking directly to the
NT API, but I've not actually seen that API. What we get is the Win32
API instead.

Alan Bellingham
-- 
ACCU Conference 2004 - http://https://www.accu.org/conference/
Technical Details
Message-ID: <6j5k909upviea1kd4dui2u0dupfodg2jvv@4ax.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!fr.ip.ndsoftware.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4090ce56@newsgroups.borland.com> <409152c9$1@newsgroups.borland.com> <409a0030$1@newsgroups.borland.com> <409a0454$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,ae4b21ed9340f943
X-Google-Attributes: gid10cc67,public
From: Alan Bellingham <alanb@episys.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: MouseHook,Message From DLL to Application while not on Focus 
Date: Thu, 06 May 2004 11:59:19 +0100
Reply-To: alanb@episys.com
Message-ID: <6j5k909upviea1kd4dui2u0dupfodg2jvv@4ax.com>
References: <4090ce56@newsgroups.borland.com> <409152c9$1@newsgroups.borland.com> <409a0030$1@newsgroups.borland.com> <409a0454$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 2.0/32.646
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 193.129.251.130
X-Trace: newsgroups.borland.com 1083841158 193.129.251.130 (6 May 2004 03:59:18 -0700)
Lines: 54
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!fr.ip.ndsoftware.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail