1

I know that this is (somewhat) variable based on implementation and platform, but in general, what is the fastest method of inter-process communication in the following 2 areas: 1) Alerting other processes 2) Sharing data among processes

For alerting other processes, i tested boost::interprocess semaphores and c-style interrupts, using SIGUSR1 and SIGUSR2. What i found surprising was that c-style interrupts were actually slower than the boost semaphores. Not sure if there is a better way to do it, i seem to be getting times in the 35usec range for semaphores and the 78usec range for interrupts. I can post the code i used to test this if this is a surprising result.

For sharing data among processes, i was using boost::interprocess:shared_memory_objects. Seems reasonable fast, but not sure if there is anything better out there. I'm not looking for a definitive answer so much as a direction in which to go test and look.

Oh, and i am primarily looking for linux-answers; if a method doesnt work on windows, thats fine by me.

jekelija
  • 257
  • 4
  • 16
  • 1
    Use shared memory + spin on some flag in that memory. – Anonymous Nov 07 '14 at 19:44
  • Whoah, that's a broad question. Since you remarked the [tag:boost] tag, I'd guess your question goes along with the inner workings of `boost::asio`? – πάντα ῥεῖ Nov 07 '14 at 19:46
  • You might be interested in [0MQ](http://zeromq.org/) which aims for such stuff AFAIK. – πάντα ῥεῖ Nov 07 '14 at 19:49
  • Agreed its a broad question; just looking for broad answers as well. I've played around a bit with zeromq but found it generally to be slower than any shared memory paradigms. – jekelija Nov 07 '14 at 19:52
  • 1
    @πάνταῥεῖ asio does not do IPC. It does IO (of course there's Boost Atomic, Boost Interprocess, Boost IOStreams and Boost Lockless that can be leveraged to great effect) – sehe Nov 07 '14 at 19:56
  • 1
    Fastest as in bandwidth or latency? – dtech Nov 07 '14 at 20:06
  • Ideally, balancing the two. Need to move a large amount of data as quickly as possible. – jekelija Nov 07 '14 at 20:24
  • "Ideally, balancing the two" -> profile profile profile, perhaps even tune it with live feedback – sehe Nov 07 '14 at 20:38
  • I'm not sure what you mean by "profile profile profile". I need to move a high volume of data (2 GB/sec) between processes, and alert each other to the moving of the data, in as little time as possible due to the nature of the application; i posted this in case there were other solutions i was missing other than ones i listed above. I was kinda hoping there would be some "Oh, try this library, it supports process wake-up in generally < 10usec and is generally acknowledged as the fastest for moving/sharing data across processes" – jekelija Nov 07 '14 at 20:46
  • 1
    Yet you want "to ideally balance the two". Mind you, both "two" are unknowns. You never told us where you're getting the source data from and what the arrival rate is, what the chunk size is allowed to be etc. Therefor: build it as simple as possible (just share some memory and signal "buffer available") and, yes indeed, profile it. You already know you'll want to be tuning it, one cannot tune without profiling anyways. – sehe Nov 07 '14 at 21:09

0 Answers0