Fireship · @fireship
Erlang in 100 Seconds
Uploaded March 18, 2024 · Length 2:44
Summary
erlang explained in 100 seconds, a functional programming language for fault-tolerant systems with concurrent execution and message passing.
- erlang
- functional programming
- concurrency
- message passing
- fault tolerance
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
erlang a functional fault tolerant
- 0:02
programming language and runtime famous
- 0:04
for scaling up the entire
- 0:05
telecommunications industry with its
- 0:07
bare hands it was developed in 1986 at
- 0:10
Swedish company Ericson where massive
- 0:12
concurrent systems were needed to handle
- 0:14
millions of phone calls in parallel
- 0:15
early implementations were written in
- 0:17
prologue but that was too slow and that
- 0:19
led to the development of beam a virtual
- 0:21
machine that compiles earling to bite
- 0:23
code which is then executed in a
- 0:25
threaded environment where millions of
- 0:27
processes can run concurrently with very
- 0:29
low overhead but when your code breaks a
- 0:31
process the earling philosophy is to let
- 0:33
it fail so the entire system doesn't
- 0:35
come crashing down that process
- 0:37
isolation is what makes it fall tolerant
- 0:39
in addition this facilitates hot code
- 0:41
swapping at runtime to perform software
- 0:43
updates with zero downtime in the late
- 0:45
9s the llang ecosystem was open source
- 0:48
as the open Telecom platform and the
- 0:50
beam BM is still in use today by modern
- 0:52
languages like elixir and gleam and beam
- 0:54
has help messaging tools like rabit mq
- 0:57
Discord and WhatsApp handle billions of
- 0:59
messages every day and that's all thanks
- 1:00
to a programming model based on message
- 1:02
passing that works just like your
- 1:04
mailbox to understand erl Lang's
- 1:06
legendary concurrency model though we
- 1:07
need to look at some code get started by
- 1:09
installing it then create a file ending
- 1:11
in Earl first declare a module then
- 1:13
write a function that contains one or
- 1:15
more Expressions separated by commas
- 1:17
just like a sentence the function ends
- 1:19
when you hit a period Then export the
- 1:20
function from the module and notice this
- 1:22
sl0 here that indicates the function
- 1:25
takes zero arguments now open the
- 1:27
terminal and run Earl C to compile this
- 1:29
code in into a Beam file and now we can
- 1:31
use Earl to open the llang shell and
- 1:33
execute this code pretty cool but now
- 1:35
let's run the same function a thousand
- 1:37
times concurrently in this function
- 1:39
we'll use spawn one of LL Lang's
- 1:41
concurrency Primitives that executes
- 1:42
each function independently on its own
- 1:44
process and returns a process ID for
- 1:47
each one of them the double bars here
- 1:48
will map those IDs to a new list now
- 1:51
when we execute this code we get a lot
- 1:52
more hello worlds and an array of their
- 1:55
process IDs where this concurrency model
- 1:57
really shines though is with message
- 1:58
passing in this example the start


