Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Como concorrência funciona em Elixir?
Search
Amanda
February 03, 2018
Technology
240
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Como concorrência funciona em Elixir?
Amanda
February 03, 2018
More Decks by Amanda
See All by Amanda
Lessons Learned From an Elixir OTP Project
amandasposito
2
110
Aprendizados de um projeto Elixir OTP
amandasposito
4
650
SOLID - Dependency inversion principle
amandasposito
0
100
Programação Funcional & Elixir
amandasposito
3
140
Ecto, você sabe o que é ?
amandasposito
4
250
Novidades no Rails 5
amandasposito
0
110
Rails Engines & RSpec
amandasposito
0
250
Elixir e Phoenix
amandasposito
3
600
Elixir em 5 minutos
amandasposito
1
110
Other Decks in Technology
See All in Technology
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
270
Podは生きているのにGoだけが落ちる:GOGCとGOMEMLIMITで追うInvisible OOM Killの謎
tkc66buzz
1
240
2026-09-10 【Snowflake World Tour Tokyo 2026】dbt Core と Snowflake で実現する多層的なデータガバナンス / Multi-Layered Data Governance Powered by dbt Core and Snowflake
civitaspo
0
280
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
3
720
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
220
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
3
240
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
4
1k
enechainの内製セルフサービスプラットフォーム
hiyosi
0
150
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
1
180
2026-09-04 SRE Tech Talk #15 怠惰なTerraform / Lazy Terraform
masasuzu
0
230
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
120
Sigmaで作る業務アプリ
kazushiro_honma
0
100
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Marketing to machines
jonoalderson
1
5.8k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
510
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
Design in an AI World
tapps
1
310
WCS-LA-2024
lcolladotor
0
820
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
230
Transcript
Como concorrência funciona em Elixir?
amandasposito.com.br @amsposito linkedin.com/in/amandasposito
None
https://plataformatec.recruitee.com/
Por que falar sobre concorrência?
None
O que é concorrência?
Paralelismo?
Concorrência vs Paralelismo
Por que isso é importante?
http://www.gotw.ca/publications/concurrency-ddj.htm
Como isso interfere no nosso software?
Mas e como isso funciona em Elixir?
Estado explicito
Processos
Troca de mensagens
Processos são a base do modelo de concorrência em Elixir
São totalmente isolados
Processos rodam concorrentemente e podem rodar em paralelo
Troca de mensagens
None
Processos podem ser supervisionados
Como isso funciona exatamente?
Scheduler
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
CPU Scheduler Scheduler CPU Scheduler CPU Scheduler CPU BEAM
O que acontece quando um processo falha?
Let it crash
None
Mas como?
Processos não são isolados?
Sim
Arvore de Supervisão
SUP Process Process Process
Estrategias de restart
One for one
SUP Process Process Process
SUP Process Process Process
SUP Process Process Process
One for all
SUP Process Process Process
SUP Process Process Process
SUP Process Process Process
Rest for one
SUP Process Process Process
SUP Process Process Process
SUP Process Process Process
Tolerância a falhas
Como que nós usamos processos em Elixir então?
Task
{:ok, task1} = Task.async(fn -> do_some_work() end) {:ok, task2} =
Task.async(fn -> do_more_work() end) Task.await(task1) Task.await(task2)
Agent
{:ok, pid} = Agent.start_link(fn -> 0 end) value1 = Agent.get(pid,
fn x -> x end) Agent.update(pid, fn x -> x + 1 end) value2 = Agent.get(pid, fn x -> x end)
GenServer
E esse tal de OTP?
None
Task, Agent e Genserver são OTP complient
Preciso implementar isso tudo na mão?
Sim e não
Recapitulando
Concorrência é conseguir realizar várias tarefas no mesmo intervalo de
tempo
Processos são muito importantes para concorrência
Processos podem ser Supervisionados
Arvore de supervisão acontece quando temos vários supervisores
Task é uma abstração para controlar processos simples
Agent é uma abstração para lidarmos com Estado
GenServer é uma abstração que pode controlar processos e estados.
Obrigada!