A DSP task in Erlang ?

Ulf Wiger <>
Tue Jan 20 18:52:10 CET 2004


On 20 Jan 2004 17:12:09 +0100, Massimo Cesaro <> 
wrote:


> I'm developing an audio conference with N pars in the conference.
> To keep up with the RTP streaming rate, I must sum from 3 to 8 packets
> (my lists) in less than 10ms. Afterward, I have to subtract for each
> part its own source, basically to cancel echo, and stream everything
> back on the network.
> This should be done agan in less than 10 ms, so the total processing
> time should be lower than 20 ms.
> I'm concerned of  what happens if and when the garbage collector kicks
> in.

If you spawn a fresh process, run the 10 ms job, and then terminate
the process, you can dimension the process heap so that there is no
garbage collection. This is done with

spawn_opt(Fun,[{min_heap_size,Words}]), or
spawn_opt(M,F,A, [{min_heap_size,Words}]).

In order to find out how big the heap needs to be, you can try
spawning a normal process and running a worst-case job while
tracing on garbage collections (see erl -man erlang for info
on the trace options.)

Spawning a process takes only a few microseconds, so that cost
is not something to fear.

/Uffe
-- 
Ulf Wiger, Senior System Architect
EAB/UPD/S




More information about the erlang-questions mailing list