Shared memory IPC using NIO memory-mapped files -- anyone done this?
Brian Maso <[email protected]>
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <20070818150601.RMGH5701.fed1rmmtao105.cox.net@fed1rmimpo02.cox.net> |
Java NIO supports memory-mapped files, which has the cool ability to allow multiple apps to share the same array of data if they all map the same file in to their respective address spaces. I've wondered about using memory-mapped files for inter-process communication for a while. Someone I know is asking me whether or not this is good to use for high-performance communication between Java and C++ -- basically sharing fixed-length records between Java and a C/C++ program in a producer/consumer sort of system. It seems like memory-mapped files would be ideal for sharing data like this. A Java app could extract data from some source and put it in to a MappedByteBuffer, which would immediately be visible to any other app on the same box that has mapped the same file. However, I can't figure out how the Java process would "signal" the external app, indicating that a new record is available for consumption, or alternatively how an external app would signal the Java app to tell it to write out a new record to the shared memory space. Anyone familiar with shared memory inter-process communication out there who can give me a hint? Google and the regular sources aren't revealing anything to me this morning. Brian Maso =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com