Geovane Fedrecheski
Universidade de São Paulo
Escola Politécnica da USP
geonnave@gmail.com | geovane@lsi.usp.br
Then they created Erlang
Runs in the BEAM (Bjarne's Erlang Abstract Machine) Virtual Machine
Other ! {self(), 10}. % async send
receive % block *this* process
{Other, NewNumber} ->
io:format("got ~d", [NewNumber])
after % timeout
5000 -> halt()
end.
receive % process "Other" is waiting a message
{Origin, Number} ->
Origin ! {self(), Number * -1}
end.
(Open Telecom Platform)
supervisor
gen_server
gen_fsm
fault-tolerance
hot swapping
in-VM,
user-land processes!
communicate via message passing
Examples:
a mix of
web and embedded devices
private memory (stack, heap)
per-process generational GC
Java serial and Concurrent GC
still nondeterministic, but better than stop-the-world GCs
Preemptive
round-robin, preempt at ~2000 reductions
Four priority levels:
Erlang Runtime Sytem =~ Operating System
run queue low
Scheduler
blocked waiting processes
in-queue waiting
Running
blocked waiting
run queue normal
Problems with Erlang native scheduler
Solution: HARTE a Hard Real-Time scheduler to run as a service in the BEAM
"Leverages Erlang VM, while also being successfully used in web development and the embedded software domain"
% hello.erl
-module(hello).
-compile(export_all).
hello() ->
io:format("~s~n", ["Hello world!"]).
# hello.ex
defmodule Hello do
def hello do
IO.puts "Hello World"
end
end