Getting Started with Erlang
In Erlang, each thread of execution is called a process.
(Aside: the term “process” is usually used when the threads of execution share no data with each other and the term “thread” when they share data in some way. Threads of execution in Erlang share no data, that is why they are called processes).
Each process has its own input queue for messages it receives. New messages received are put at the end of the queue.
If there are no more patterns to test, the first message is kept in the queue and the second message is tried instead. If this matches any pattern, the appropriate actions are executed and the second message is removed from the queue (keeping the first message and any other messages in the queue). If the second message does not match, the third message is tried, and so on, until the end of the queue is reached. If the end of the queue is reached, the process blocks (stops execution) and waits until a new message is received and this procedure is repeated.
Notice how the operator “!” is used to send messages. The syntax of “!” is: Pid ! Message That is, Message (any Erlang term) is sent to the process with identity Pid.
3.4 Distributed Programming
The distributed Erlang implementation provides a very basic authentication mechanism to prevent unintentional access to an Erlang system on another computer. Erlang systems which talk to each other must have the same magic cookie.
$ cd $ cat > .erlang.cookie this_is_very_secret $ chmod 400 .erlang.cookie
Each Erlang system running on a computer is called an Erlang node.
Erlang systemは一般的にErlang nodeと呼ぶ