Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way for interprocess communication in C++

I have two processes one will query other for data.There will be huge amount of queries in a limited time (10000 per second) and data (>100 mb) will be transferred per second.Type of data will be an integral type(double,int) My question is in which way to connect this process?

Shared memory , message queue , lpc(Local Procedure call) or others....

And also i want to ask which library you suggest? by the way please do not suggest MPI. edit : under windows xp 32 bit

like image 444
Qubeuc Avatar asked Dec 16 '08 18:12

Qubeuc


Video Answer


1 Answers

One Word: Boost.InterProcess. If it really needs to be fast, shared memory is the way to go. You nearly have zero overhead as the operation system does the usual mapping between virtual and physical addresses and no copy is required for the data. You just have to lookout for concurrency issues.

For actually sending commands like shutdown and query, I would use message queues. I previously used localhost network programming to do that, and used manual shared memory allocation, before i knew about boost. Damn if i would need to rewrite the app, I would immediately pick boost. Boost.InterProcess makes this more easy for you. Check it out.

like image 120
Johannes Schaub - litb Avatar answered Sep 23 '22 18:09

Johannes Schaub - litb