1

Cross-process memory buffers always have some overhead, and my understanding is this is quite high. But what if you're implementing a cross-process render-buffer, this isn't critically important in the same way as other data, so are there techniques we can use to get 'raw' access to a chunk of memory from multiple processes, with no safety nets apart from it not crashing? Or do modern operating systems simply not work with unabstracted memory in a way to make this possible... in the old days couldn't you get a pointer to ANY place in memory?

I'm working in C++ but the question applies to Win XP/Vista/7, MacOSX 10.5+ (& Linux less importantly).

2
  • question is - without some form of synchronization, how does your second process know whether to render the frame or not? I'd hazard that implementing something like this (say using a semaphore) is not going to add too much extra overhead compared to the actual rendering/display steps for a given frame...
    – Nim
    Mar 16, 2011 at 8:54
  • Communicating a message across processes is very tiny, the issue is I don't want the writing/reading to a buffer to be slowed down by safety measures and locking, etc, this can be 5Mb of data or more.
    – Mr. Boy
    Mar 16, 2011 at 10:18

1 Answer 1

8

Memory mapped files are the way to go here.

2
  • Really, using a file as a shared resource? Is that performant if you're rendering at 60fps, and each frame render the scene to the buffer in one process and from the buffer to the screen in another? I couldn't get an answer exactly how much of the 'file' part is relevant in memory-mapped files.
    – Mr. Boy
    Mar 16, 2011 at 8:17
  • 2
    The "file" part is for your purposes just a way to give the resource a unique name by which it can be shared. All you get when you call the function is a raw pointer to memory, which other processes can also retrieve by simply calling the file mapping function with the same file name.
    – demonkoryu
    Mar 16, 2011 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.