Any good suggestion for asynchronous shared memory I/O?

Any good suggestion for asynchronous shared memory I/O?

Post by S3VuIE5pd » Thu, 24 Jan 2008 10:42:15


Dear all,
I'm trying to implement an IPC program.
I find that shared memory is a bit easy to use.
But I can't find any example about how to achieve asynchronous shared memory.
That is one process can send and receive message at any time with the other
process.
Any advice will be appreciated.
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by Scott McPh » Thu, 24 Jan 2008 13:18:10


Shared memory is not asynchronous. Shared memory is not I/O. Shared memory
does not send or receive messages. So your question is quite inscrutable.

*ptr = 3; // writes to shared memory at ptr

x = *ptr; // reads from shared memory at ptr

These two operations are all you can do with shared memory.

--
Scott McPhillips [VC++ MVP]

 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by Chris Thom » Thu, 24 Jan 2008 13:51:53


Read here for a simple solution for IPC communication:

http://www.yqcomputer.com/

BTW, are you making a "Robust" IPC mechanism?
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by S3VuIE5pd » Thu, 24 Jan 2008 15:31:01

Thank you.
Maybe I've been misled by someone else.:)
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by S3VuIE5pd » Thu, 24 Jan 2008 15:39:01

Thanks for your reply.
I've created my program with named pipe.
But it seems that it fails to work.
I've got such plan.
All the named pipe have names like "\\.\pipe\nameXX" where XX stands for two
numbers.
The numbers are generated dynamically.
I have one named pipe in one process as a server.
Then the process creates the other process.
The second process has a named pipe with the name name(XX+1).
Then the second process listens on the named pipe.
After that the second process will create a named pipe client which connects
to the first process's named pipe.
At last, the first process will create a named pipe which connects to the
second process' named pipe seerver.
By doing this, I can send and receive message from named pipe on both
directon asynchronously.
But I always get a 997 error when make the second process' named pipe.
Before that line of code, I can't find any code which called connectnamedpipe.
Are there any restrictions wiht named pipe on windows system?

Thanks for further information.
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by S3VuIE5pd » Thu, 24 Jan 2008 15:40:00

Any way, the more robust, the better.:)
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by Stefan Kuh » Thu, 24 Jan 2008 22:09:55

Hello Kun Niu,



Get a life and use RPC. It is robust and used all over the place in
windows system components and you have the ability to choose the
underlying protocol sequence, such as LRPC (shared memory), named pipes,
tcp or whatever else RPC supports.


--
Stefan
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by Pavel A » Fri, 25 Jan 2008 06:03:58


On multiprocessor machines you need to obey certain rules
to ensure that data written by one thread is seen correctly by other threads.
Please visit the Intel software community forums for more info.
http://www.yqcomputer.com/

http://www.yqcomputer.com/


Regards,
--PA
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by S3VuIE5pd » Fri, 25 Jan 2008 12:33:13

Thank you for your suggestion.
I'll pay attention to that.:)
 
 
 

Any good suggestion for asynchronous shared memory I/O?

Post by S3VuIE5pd » Fri, 25 Jan 2008 12:40:25

Thank you for your suggestion.
May be it's a good choice for a change.
And I may also use RPC on *nix.
There are really sockets taken up by other processes on my system.
So I'll try not to use socket for asynchronous IPC.