[erlang-questions] Erlang basic doubts about String, message passing and context switching overhead

Michael Truog mjtruog@REDACTED
Sun Jan 15 03:25:25 CET 2017

||This thread started to talk about the need for unicode functionality in Erlang and how it exists currently in Elixir but not in Erlang.  I created a repository with the Elixir functions created as Erlang functions in an Erlang module as an example of what I want at https://github.com/okeuday/unicode_data/

The generated module (unicode_data) only includes functions from the first Erlang module contained in unicode.ex (Elixir.String.Unicode) though it does bring up some important topics:
1) Add the unicode version to the Erlang module version.  The generated unicode_data module has a timestamp suffix, so we know both the unicode version and the timestamp when the unicode_data module was generated.
2) Use only lists, not binaries, to make sure all temporary data stays on the heap of the Erlang process.  That should be best for performance, though I haven't proved that with any performance testing.

I haven't added tests, though I have compared the unicode_data Erlang module, to the Elixir.String.Unicode module and the data looks correct.  Mainly thought this would help the discussion.

Best Regards,

On 01/10/2017 10:58 AM, Bhag Chandra wrote:
> Hello,
> I have been coding in Erlang for 2 years.  A wonderful language but not very big community, so I cant discuss my questions with programmers around me (Java, Python guys). I found out about this list today.
> I have some fundamental doubts about the Erlang. It would be great if someone can help me clarify them.
> 1) "Strings in Erlang are internally treated as a list of integers of each character's ASCII values, this representation of string makes operations faster. For example, string concatenation is constant time operation in Erlang."  Can someone explain why?
> 2) "It makes sense to use Erlang only where system's availability is very high".  Is it not a very general requirement of most of the systems? Whatsapp to Google to FB to Amazon to Paypal to Barclays etc they all are high availability systems, so we can use Erlang in all of them?
> 3) "Every message which is sent to a process, goes to the mailbox of that process. When process is free, it consumes that message from mailbox". So how exactly does process ask from the mailbox for that message? Is there a mechanism in a process' memory which keeps polling its mailbox. I basically want to understand how message is sent from mailbox to my code in process.
> 4) We say that a message is passed from process A to process B by simply using a bang (!) character, but what happens behind the scenes to pass this message? Do both processes establish a tcp connection first and then pass message or what?
> 5) At 30:25 in this video ( https://youtu.be/YaUPdgtUYko?t=1825 ) Mr. Armstrong is talking about the difference between the context switching overhead between OS threads and Erlang processes. He says, thread context switching is of order 700 words but Erlang process context switching is ... ?
> I cant understand what he said, if someone could tell.
> P.S. Please excuse for any grammatical errors, English is not my first language.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170114/a27a3042/attachment.htm>

More information about the erlang-questions mailing list