If you have 2 difference Executive that will be using nearly all of the same things in memory.... What is the best way for App2.exe to share and use App1.exe Memory without losing speed and endurance.

Also is there a way to lock this shared memory so that no other outside app can use it or interfere with it process while running. Any ideas would be appreciated.

Thank in advance
Posted on 2002-05-03 09:33:35 by cmax
Well,

From what I've learnt so far, applications don't have access to other applications memory. And you can only really access other applications memory by gaining access to ring-0 (Kernal level) ...

What I would do is, create pipes between your applications to that they can communica with each other and app2.exe can ask app1.exe what the value is of such and such of thing.

I don't know if I'n right, I think I am, not sure ...
Posted on 2002-05-03 09:36:59 by Dracton
you can write and read to the processes but IMO the easiest way is to do filemapping.
Posted on 2002-05-03 09:37:44 by Hiroshimator
I figured that filemapping will be the best way to go but i think i will learn to do it the hard way first that way i will learn a little bit more. I think this is going to be very interesting.

I don't want my project to waste no one memory when they need to run both of my app's at once. I like the create pipes idea also.... Yes i think i will go the hard way and get on it right now....

Thanks Guys

and Happy Birthday Hiro ... Thanks for all you and your partners have done for us and still doing...
Posted on 2002-05-03 10:26:17 by cmax
Your welcome :)
Posted on 2002-05-03 10:30:53 by Dracton
cmax, pipe functionality is OS dependant I think. IIRC win9x has very limited functionality compared to NT based MS OSes. about wasting memory, you waste lesser memory if you do a filemapping.
Posted on 2002-05-03 10:31:21 by Hiroshimator
cmax, the easiest way to share code/data between processes...
is doing nothing :). Unless you're packing your executables,
windows will share non-modified pages automatically (code,
static data, resources). If you need to share modified data,
look into shared sections (link /section:.shared,rws --- or
something like that). I haven't messed much with shared sections,
but they should prove useful.

Filemapping should work well too, but it has overhead and iirc
it allocates space in the swapfile almost immediately (at least
the docs state that a filemap that isn't created from a file
(but rather INVALID_HANDLE_VALUE) is backed by the paging file...).

Pipes should work fine on 9x as long as you stick with the
"standard" pipes.


Also is there a way to lock this shared memory so that no other
outside app can use it or interfere with it process while running.

No. And any attempts to do this will cause a lot more problems than
it will solve.
Posted on 2002-05-04 01:45:46 by f0dder
"you waste lesser memory if you do a filemapping."

That's all i want to do. I been trying to avoid using a Resource Window. But I think i am going to have to just to keep this thing simple so i can finish up an move on to something new before i mess it all up. (I think i been getting very close to doing just that)

Thank for putting it all in perspective f0dder... If i use something filemapping must be the key because it problely work with all Windows version. Time for me to face reality...
Posted on 2002-05-04 15:43:40 by cmax
All the methods mentioned will work with all windows versions.
I think filemapping will be one of the more wasteful methods, apart
from using some kernel memory (most methods will), it will cause
new entries to be added in the page tables, it will use the paging
(swap) file, etc.

Could you clarify what sort of "sharing" you want to do? Resources?
read-only data/code? Some data that will be set up (written) once,
then have read-only access? build-time static data with readonly
access?
It's hard to suggest a good sharing method before you tell us what you need :).
Posted on 2002-05-05 06:21:13 by f0dder
cmax,

Memory mapped files are probably the best choice for what you have so far described, they can be set up dynamically, from memory they increment in 4k blocks so you can dial up a single memory mapped file to fit what you are after with no fear of wasting memory.

If you pass the handles of the two or more apps that use the memory mapped file so that each can contact the other, you can trigger events in both apps with no problems by sending messages to the correct window in the other app.

Regards,

hutch@movsd.com
Posted on 2002-05-05 06:37:25 by hutch--
f0dder

Lets say you got two difference Executive Windows, One at the top right most and the other at the Bottom left most... They don't have to be seen or used unless the user call for them. Basically their only job is to WATCH Windows, User Activity, and some basic Internet Activity while that user is using it....It even give the user the oppitunity to set up his own STYLE and not use my default features... Plus a big A bonus that i can't mention but you will see... Executive-1 has a hook dll but all of the code is inside Execitive-1 so there will be no Waste, Flaws or Crashes period or whatsoever and it don't eat memory, I wrote it down to a real science i think and i still got to see about the Lib thing that you suggested, that may make it even better but i don't really understand it yet ...

But as of now If anything slip up in any kind of way i got it set up so that executive-2.. Will be notified and will therefore take over Executive-1 and it problems and do as it please if i know the best way to communicate with it instead of having the extra set of ode in memory... It will be playing something like a game of tennis if i do it right.

The code in memory may be simple things like close all Windows... dial up.... or shut down windows.... basic stuff like that but it don't need the code to be written twice in memory or in the Executives twice if i know the very best way to ommunicate with each other....Believe me my code is down by law, I learn a lot of stuff here to get to this point and it works wonderful. But it's darn near 80% masm32.lib style API....i wish i could go 95%

Right now i got most of this so-call controlling each other by sendmessges push button and Do IT... I hate sendmessges expecially through a button but i can't think of a better to do it, but that's another story.... but if hutch say sending messages, maybe it's not bad as i thought, I just believed that it was slow and that there were even better ASM ways (even lower levels way of doing it)...

I think this is so cool for them to take over one another when needed depending on the situation ( just passing the buck back in forth to each other until the job is completed), i just need to learn what is the best way to play it with-out near double memory..... I want full cooperation since i know how to write the code for it anyway and got it this far and i feel i fail if i don't ... I want to push it to it true limit and get real gain out of it if Possible, if not there no since in swaping one for the other to get other types of losses...
This is the only way i can explain it right now...


Anyway thanks for these great ideas, if there any other move that you think i should make please let me know.


PS:
I am less than 3 months to be totally out of the printing business. I been moving for the past few weeks and had to sacufice more than half of my equipment that i worked for over the pass 10 years.... I am in shock with no mo money...and no mo free time....You never know what is going to happen down the line when it time to retire....in my case.....COLD Blooded

But it brought me time to learn ASM and stay with the Board though ....


Page tables

.................................
Posted on 2002-05-08 03:19:57 by cmax
Is it going to be two instances of the same executable, or is it
two different exe's? If it's two instances of the same exe, sharing
of untouched data is done automatically by windows. If it's two
different exe's and they have a bunch of code in common, move the
common code to a DLL. Depending on what type of communication
you need between the apps, EVENT objects might be sufficient -
messages isn't too bad an idea if you need something a bit more.
Or, pipes with blocking I/O in a separate thread... there's a lot of
possibilities.
Posted on 2002-05-10 08:15:04 by f0dder
It's two difference *executive* that will be using some of the same information from a group of buffers in the .data? The code is difference in each *executive* but has a difference job to do. "there's a lot of possibilities" If i can get this done then i can say i REALLY did it right...."No wasted memory" ...Time to hit the books and help files. I am going to try doby code first from his *share* section post and go from there...I don't really know anything about the linker and this will get me started.

Thanks everybody, i am going to get this thing, It's a thrill to know that there are all kind of things that can be done...I will get the best way out of it i am sure but i think doby way got to be the best way because for me it's all about Data Only...This what i call ideas, i am tried of that dumb protection stuff getting in the way of greater ideas... i leave that to the real Pro's and buy it....
Posted on 2002-05-10 20:15:51 by cmax
Sounds like a DLL with shared section is what will fit your needs best,
just be careful when writing, you can end up with impartial data
(ah, the joys of multi-threading/processing :)).
Posted on 2002-05-11 05:18:14 by f0dder