Introduction

Joe Armstrong (AL/EAB) <>
Thu Sep 8 08:25:24 CEST 2005



> -----Original Message-----
> From: 
> [mailto:]On Behalf Of Saifi
> Sent: den 7 september 2005 18:07
> To: 
> Subject: Introduction
> 
> 
> Hi:
> 
> I would like to introduce myself as Saifi Khan and an Erlang newbie.
> 

Welcome ...


> While taking reading Tim Bray's blog on CMT
> http://www.tbray.org/ongoing/When/200x/2005/06/20/Threads
> I happened to read about Erlang.
> 
> I also read Joe's paper on Concurrency in Erlang at LL2.
> The concept of Concurrency as a construct is quite interesting.

It's not only interesting - *it's how the world works*

The world is parallel.

Most programming languages are sequential.

Programming parallel problems (ie problems interacting with the real world) in
sequential languages is *incredibly difficult*

Programming then in Erlang is *much* easier

> 
> Couple of queries about Slides -
> 
> Q. [Create more processes than OS supports.]
>    Does Erlang process imply threads here ?
 
In most languages processes and threads belong *outside* the language
and are provided by the OS - threads in C++ "means" an API that allows
you to create an OS thread.

In Erlang processes *are part of the language* - The Erlang run-time system
just uses one OS process - and implements it's own memory management and context switching *within* this process. 

So while you're using one OS process, there with be 100K Erlang processes running
inside the Erlang VM.

Note also Erlang processes are much smaller and faster to create than OS threads.

>    Are the processes (threads) here library managed ?
>    Is there a documentation for the user API somewhere ?

There is no user API - process creation is part of the language.

	Pid = spawn(fun() -> .... end)    creates a process
	Pid ! M				    sends the message M to process Pid
	receive				    is selective receive
	    {Pid1, M1} ->                 receive M1 from Pid1 or M2 from Pid2
		 ...				    etc.
	    [Pid2, M2} ->
		 ...
	end

That's it !

> 
> Q. [Message Passing is "send and pray"]

	Pid ! M means send Message M to Pid

	"send and pray" means you will never know if it *arrived* at Pid
	if you want to be sure send a reply message and wait for it

>    Is it UDP based communication ?

	No - UDP/TCP is how system talk to each other
	Two Erlang nodes might use TCP/UDP to talk to each other - though this is
	not defined
	
> 
> Q. [Erlang is used in Nortel Alteon SSL Accelerator]
>    What feature has been implemented in Erlang ? Is it SSL ?
>    (Looked a Nortel Site, but they have no data on Erlang).

I'll let the Nortel people answer this :-) 

> Q. [Things in the world don't share data]
>    Doesn't this make the program's inefficient ?

Yes - but - let's suppose you want to make a fault-tolerant system

To make a fault-tolerant system you MUST use at least TWO computers
and hope they don't both crash at the same time :-)

You must also replicate all critical data on both computers.

So Fault tolerance *implies* sharing.

So yes sharing stuff leads to efficient non fault-tolerant programs.

The key to efficiency is *parallelism* - sharing prevents (or hinders) parallelism
so non-shared data system can each work on their chunks of data in parallel
with no worries ...

So the short answer is yes it is less efficient - but the long answer is
"it has to be like this" if you want to make it scalable and fault-tolerant 


>    In C programs we have shared data among various threads ?
> 

This sucks


> Misc questions -
> 
> Q.  Is Erlang a functional programming language ?
> 

No - it's a concurrent language 

> Q. What is the best class of problems to solve with Erlang ?
>      (The slides talk about soft real-time systems).

Scalable fault-tolerant distributed soft real-time systems that must run
forever 

> Q. What class of problems *cannot* be solved using Erlang ?
>    (eg. with Java we don't do Systems programming).

None. But memory intensive computations (JPG compression, etc.) should e written
in C (note C - NOT *anything* else :-)

> Q. What are the new books on Erlang ?
>      (could find only one on Amazon.com)

No - there is a good French book (is anybody translating this?)

> I am keen to learn more about the language and have a
> C/C++/Java background.

Great - welcome to the club

/Joe


> 
> Thanks in advance.
> 
> thanks
> Saifi .        
> 
> --
> TWINCLING Society                                       
> www.twincling.org
> freedom of innovation
> 



More information about the erlang-questions mailing list