Port drivers vs Ports

Thinus Pollard thinus-list@REDACTED
Wed Aug 16 16:27:54 CEST 2006


Hi there

A Port runs in its own OS process, right? So you can stream data from one 
process to the other.

A Port Driver attaches itself to the erlang runtime system. After a few test I 
found that while the code inside the port driver is executing, the erlang 
runtime system is hanging, waiting for the port driver to return. It makes 
sense to me at least, please correct me if I'm wrong.

This would imply that I can't stream data from the port driver to erlang, 
since it is the same os process and while the port driver is streaming, the 
erlang part of the process can't accept the data, since it's blocked. 
Correct?

When I do a driver_output(port, &result, length_of_res), do the data get 
copied or does the erl_driver pass the result back in by reference?

Also, If I want to output back to erlang more than once during a call, does 
the messages (driver_output) get queued so that my erlang process can pick 
them up after the port driver has returned, or is it possible that they can 
get lost if I send to many messages?

Last Question: Which of the two communication methods are preferred / gives 
the best performance, erl_interface or communicating via character 
lists/arrays.

I need a port/port driver for connecting to a database.

Thanks in advance
Thinus



More information about the erlang-questions mailing list