在C进程间通信的最佳方法++ [英] Best way for interprocess communication in C++

查看:207
本文介绍了在C进程间通信的最佳方法++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个进程一会查询其他的data.There将在有限的时间内查询(10000每秒)和数据(> 100 MB)的巨量将每second.Type传输的数据将是不可或缺的式(双,INT)
我的问题是其中的方式连接这个过程?

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?

共享内存,消息队列,LPC(本地过程调用)或其他人......

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

,也是我想问你建议哪个库?顺便说一句,请不建议MPI。
编辑:在Windows XP 32位

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

推荐答案

一个字: Boost.Interprocess中。如果真的需要快速,共享内存是要走的路。你几乎为零开销,因为操作系统虚拟确实和物理地址之间的映射通常并需要对数据无副本。你只需要寻找并发问题。

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.

有关实际发送类似的关机的和的查询的,我会使用消息队列命令。我previously使用本地主机网络编程要做到这一点,并用手工共享内存分配,以前我知道的推动作用。该死的,如果我需要重写应用程序,我会马上接提振。 Boost.Interprocess中使这更容易让你。检查出来。

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.

这篇关于在C进程间通信的最佳方法++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆