[erlang-questions] Semaphores
Corrado Santoro
csanto@REDACTED
Thu Mar 15 14:43:34 CET 2007
Richard Carlsson wrote:
>>I am curious about this. Is the latency of sending a message so high that
>>it affects a robot? It seems to be (from a quick non very reliable test :)
>>more or less in the single digits microseconds.
>>
>>I do not think that using shared memory with semaphores would be
>>much faster (if at all), but of course I have not made any measurements :)
My first idea was to have some *native constructs* (BIFs) to allow
sharing of erlang primitive data types (I'm not talking about "memory
buffers"). Something like "put" and "get", but inter-process. So
semaphores were internal things of the VM, not visible to Erlang
programmers.
> I believe that their latency problems were due to messages being passed
> through layers of processes, so that queueing and process scheduling
> affected the total end-to-end time. (But I could be wrong.) My guess is,
> anyway, that restructuring the program could have solved the problem.
Indeed this is the point! If you take a look at the code of gen_server
or gen_fsm, you can notice that both make strong use of the "gen" and
other modules. This is due to the fact that (I suppose) "gen" implements
many "general purpose" routines that can be used by gen_fsm/gen_server
behaviours. Undoubtedly, this implies a great overhead in the code.
This is the reason why we decided to rebuild a "timed-fsm" behaviour,
making it very light. We made some tests today: prompt response and good
performances!
--Corrado
--
==================================================================
Eng. Corrado Santoro, Ph.D.
University of Catania - ITALY - Engineering Faculty
Tel: +39 095 7382380 VoIP: sip:7035@REDACTED
Personal Home Page: http://www.diit.unict.it/users/csanto
NUXI Home Page: http://nuxi.diit.unict.it
==================================================================
More information about the erlang-questions
mailing list