shared memory

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

Hi guys!!

I'm asking if is possible to create 2 different programs and at the running
each one, can access to shared memory and modify and read data in it? (not
at the same time but can see data the other write in memory).

If so, where can i find information about it??

Thanks!!
 
I'm asking if is possible to create 2 different programs and at the
running each one, can access to shared memory and modify and read data in
it? (not at the same time but can see data the other write in memory).

Hi,
it is not so difficult. check here for the reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/file_mapping.asp

alternatively, you can create a dll and mark a variable (an array for
example) with the pragma data_seg directive
http://msdn2.microsoft.com/en-us/library/h90dkhs0.aspx

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Rick said:
I'm asking if is possible to create 2 different programs and at the
running each one, can access to shared memory and modify and read data in
it?

Yes.

You use what's called a memory mapped file. Check the docs for
CreateFileMapping(), OpenFileMapping() and MapViewOfFile().

Note that you have the option of using your own file for the mapping or not.
If you choose not, then the system's paging file is used as the "backing
store" for the shared memory.
(not at the same time but can see data the other write in memory).

I'm not sure I understand you. Once the shared memory is mapped into two or
more processes, each of them can read and write at will. It would be your
responsibility to handle any concurrency / synchronization issues.

Regards,
Will
 
Thanks Will!!!


William DePalo said:
Yes.

You use what's called a memory mapped file. Check the docs for
CreateFileMapping(), OpenFileMapping() and MapViewOfFile().

Note that you have the option of using your own file for the mapping or
not. If you choose not, then the system's paging file is used as the
"backing store" for the shared memory.


I'm not sure I understand you. Once the shared memory is mapped into two
or more processes, each of them can read and write at will. It would be
your responsibility to handle any concurrency / synchronization issues.

Regards,
Will
 
Back
Top