[erlang-questions] Efficiency of passing data through port owner

Richard Andrews bbmaj7@REDACTED
Tue Jul 31 14:49:23 CEST 2007

I have a set of processes in mind:

Receiver process assembles out-of-sequence parts of a large message sent by
other processes so the whole message can go out a port as a binary when

PortIO process handles data coming back from the port ExternalPort and as such
is the port owner.

I'm inexperienced with using ports and I'm looking for hints on how to
efficiently get the data accumulated in Receiver out through ExternalPort. The
obvious approach is to send the full message to PortIO which then sends it to
ExternalPort, but I am concerned that this introduces inefficiency due to the
size of the message.

Would the above strategy result in a copy of the message binary being made from
Receiver to PortIO prior to being pushed out the port?

Is is possible to send directly from Receiver to ExternalPort (eg. registered
port), but have data come back from ExternalPort into PortIO?
If possible, is it a recommended approach?

Is it possible for PortIO to also reliably send messages and admin commands to
ExternalPort in this situation? Is there a potential for messages to get
corrupted by interleaving if sent to the port from different processes at the
same time?

Would TCP be better than a pipe-based port?

The system will be running on a linux 2.6.x kernel.

Thanks for any input.

Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. 

More information about the erlang-questions mailing list