开发者

shared memory across compilers?

I have to start off by saying I have very little idea on this topic so humor me if i seem ignorant.

Due to the problem of having to use a vc++ library in a g++ compiled program, I built a local server-client system where the server is compiled in vc++ and the client in g++ and 开发者_JAVA技巧they interact through sockets. A lot of data transfer occurs across the socket(close to 2,00,000 records each of 22 fields) and it is a major bottleneck and slows down the entire process a lot. Is there someway I can have a sort of shared memory between the server and client processes so that access would be much faster?


I assume you're using this on a Windows system? (You don't say.) Since it's local client-server, you do have other options.

For windows cross-process communication of large amounts of data, you should look at using memory-mapped files, I think. These can be shared using clobal memory handles. Then with shared kernel objects for synchronisation (mutexes, I would suggest, or events) you can control the access to make sure that it's done in a safe manner.

Provided it's always local, that is probably your fastest and safest method.

(I'd give you more specific API information, but I took my books home yesterday as part of an office clear up - sorry!)


If they are on same PC then yes, shared memory is faster and it defenetly work across different programs.

If it's on different PCs then also yes, but it's not gonna be faster than sockets.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜