Thread: Sharing Memory among Processes

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    19

    Sharing Memory among Processes

    How can i share some memory space among two programmes (or processes)?

    I have two executable running on the same machine and i want to share a particular variable (like different threads share variables).
    I was thinking of writing a third program that launches these two executables as a process, but how do i get them to share?

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    Well, I doubt you can do it like this with managed code. You may be able to use a memory mapped file though.

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    19
    I dont know what is a memory mapped file. Can you give me a link to a tutorial or some place where they can provide info on this topic/books recommended etc.

  4. #4
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    MapViewOfFile, search MSDN for that. I don't know if .net can use it or not, but most likely it can.

  5. #5
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Another way to do it is to use Remoting.

    http://msdn.microsoft.com/library/de...ngoverview.asp

    Do they really need to run as two different processes? Can you just reference code from the other executable and call it on another thread?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-06-2009, 12:27 PM
  2. Shared Memory - shmget questions
    By hendler in forum C Programming
    Replies: 1
    Last Post: 11-29-2005, 02:15 AM
  3. Memory allocation and deallocation
    By Micko in forum C++ Programming
    Replies: 3
    Last Post: 08-19-2005, 06:45 PM
  4. Pointer's
    By xlordt in forum C Programming
    Replies: 13
    Last Post: 10-14-2003, 02:15 PM
  5. Sharing memory
    By YALINI in forum C Programming
    Replies: 1
    Last Post: 08-28-2001, 12:47 PM