Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient Erlang Port Driver

I want to spawn Erlang processes that will communicate with a C program through a Port Driver.

As spawning many of these processes can be inefficient, can I spawn one Erlang process that receives messages and queue these messages for processing with the C Program?

As this C program starts to wait for incoming jobs, will it block?

What's the best strategy/architecture?

Thanks!

like image 786
carlosalbertomst Avatar asked Sep 14 '10 22:09

carlosalbertomst


People also ask

What port does Erlang use?

The EPMD can be started explicitly or automatically as a result of the Erlang node startup. By default the EPMD listens on port 4369.

What is Port drivers?

A port driver is a linked-in driver that is accessible as a port from an Erlang program. It is a shared library (SO in UNIX, DLL in Windows), with special entry points. The Erlang runtime system calls these entry points when the driver is started and when data is sent to the port.


1 Answers

Yes, generally you have one process which is connected to the port which traffic goes through. For a reasonable description of ports and how to use them read the Erlang Interoperability Tutorial User's Guide. It explains the different types of ports and their properties.

Generally speaking the documentation at http://www.erlang.org is quite good and well worth reading.

like image 147
rvirding Avatar answered Oct 02 '22 15:10

rvirding