OpenQNX :: The QNX Community Portal

May 13, 2008 - 02:40 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 71 unlogged users and 1 registered user online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
dxx2008
Post subject: Msg passing approaches under Qnet  PostPosted: Mar 01, 2008 - 12:45 PM
Active Member


Joined: Oct 15, 2007
Posts: 58

I have developed an adhoc network among several 6.3.2 machines. Currently, one need to communicate with one another.

e.g, one process on machine A has generated some data from the data acquisition board and do some processing with it,
then the processed data need to be transferred to another process in machine B.

As i know, one way is that A put the processed data in a file, then B can access the data across the Qnet, much like
write and open a file on the wireless network. But it seems to me not very efficient, any other better ways of
transferring data? Thank u.
 
 View user's profile Send private message  
Reply with quote Back to top
maschoen
Post subject: RE: Msg passing approaches under Qnet  PostPosted: Mar 01, 2008 - 04:38 PM
QNX Master


Joined: Jun 25, 2003
Posts: 974

This can be done with message passing in two ways.
1) machine A sends a message to machine B with the data. machine B replies when it gets it.
2) machine B sends a message to machine A saying it is ready to receive data. When machine A has data, it returns it to B in a Reply.

It may be the case that you want to use 1) but A cannot wait for a network send and reply. In that case Thread 1 in machine A can put the data in a buffer, and wake up Thread 2 which sends the message.

It might also be the case that you want to use 2) and A can wait for B to reply, but it cannot tolerate waiting for B to reply a previous message. In this case, you can either use a thread pool in B, or you could do it with just two threads in B, one receives data and puts it in a buffer while thread the second processes the data.

The latter two examples require synchronization with mutexes and maybe condvars.

These methods only breaks down if 1) The rate that A receives data is slower that the rate at which B processes it, and 2) The available memory is not large enough to buffer the data before memory runs out. For this to happen you would probably need a fairly continuous stream of data.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.