* Introduction Functional language from Ericsson. Features fine-grained concurrency and *hot code replacement* (replacement of code without halting a running system), and automatic memory management. * Computation Model Concurrent entities are called *processes*. Each process consists of a port and a mailbox. The language design has two layers. ** Functional Core dynamically typed, strict (=> not lazy). Each process contains a port object that is defined by a recursive function. A process that spawns a new process specifies which function is to be initially executed. ** Message-passing extension Each process has an id unique within the system. Message Send: Processes send messages to other processes, identified by their *Process ids*. The sending process does not wait for acknowledgment receipt after a send (*asynchronous send*). The send is FIFO. Message: any value including Process ids, functions etc. Message Reception: The reception can be either blocking or nonblocking. The recepient uses pattern matching to wait for and remove messages from its mailbox, thus messages may be removed out of order. Process Dependence: Processes are independent by default. This means that sent messages are always copied to the recepient's mailbox, never shared. This forces the asynchronous send mechanism. Process dependencies must be explicitly specified. Indpendent processes are useful for building highly reliable systems. Question: If a process P terminates, its senders may keep sending to it - how can the system allow another process to gracefully replace P? can the system notify the senders to P? Both are possible in Erlang. ** Distribution and Fault Tolerance *** Transparent Distribution Machine Environment: node.Each process is associated permanently with the node in which it was created. Processes can be created at remote nodes. Programmer has complete control over process placement. Process ids encapsulate whether the operation is done on the same node (local) or on another node (remote). Sending to another node involves exactly one network operation - that is, no intermediate nodes are involved. *** Failure detection: linking *** Persistence: Aids in fault-tolerance. Provides a database called Mnesia. * Erlang Module structure The module should have the same name as the file it is in. Example, -------------------------- -module(test). -export([go/0, nop/0]). go() -> true. nop() -> false. -------------------------- should be in test.erl. Modules consists of *forms*. Each form can be an attribute like -module, -export, -import etc., or function definitions. Each form is terminated by a fullstop.