Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Concurrency in the imperative and functional world
Search
Scalone
November 17, 2015
Programming
0
160
Concurrency in the imperative and functional world
Presentation created for ITerior 2015 conference check
http://iterior.com.br
Scalone
November 17, 2015
Tweet
Share
More Decks by Scalone
See All by Scalone
TDD - Test Driven Development
scalone
0
3
Ruby, Web and IOT with the same Platform
scalone
0
63
20k mRuby devices in Production
scalone
0
370
DaFunk, IOT Framework in Ruby
scalone
0
150
Concurrency in the imperative and functional world
scalone
0
170
Git e Github
scalone
0
68
Git, o que é, do que é feito, para que serve?
scalone
0
280
DaFunk, IOT Framework in Ruby
scalone
0
160
Uzmenino Marketplace
scalone
0
100
Other Decks in Programming
See All in Programming
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
410
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
440
CSC509 Lecture 09
javiergs
PRO
0
110
Android 15 でアクションバー表示時にステータスバーが白くなってしまう問題
tonionagauzzi
0
140
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
870
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
230
Vue.js学習の振り返り
hiro_xre
2
130
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
250
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
52
32k
Identifying User Idenity
moro
6
7.9k
Realtime API 入門
riofujimon
0
110
Synchronizationを支える技術
s_shimotori
1
150
Featured
See All Featured
Writing Fast Ruby
sferik
626
61k
Navigating Team Friction
lara
183
14k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Making Projects Easy
brettharned
115
5.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Done Done
chrislema
181
16k
Being A Developer After 40
akosma
86
590k
How GitHub (no longer) Works
holman
311
140k
A Tale of Four Properties
chriscoyier
156
23k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Transcript
@Scalone Concurrency in the imperative and functional world
Thiago Scalone
[email protected]
@scalone
None
None
None
… nothing new … DISCLAIMER
If you don't understand concurrency… it isn’t problem if doesn't
make part of your day. DISCLAIMER
POINT
Context 1
None
… and the light …
None
None
None
None
None
None
Context 2
None
Concurrency
Concurrency Parallelism
“Dealing a lot of things at once Rob Pike about
Concurrency
“Doing a lot of things at once Rob Pike about
Parallelism
@Scalone
@Scalone
@Scalone
@Scalone
@Scalone
@Scalone
@Scalone
@Scalone
Context 3
Imperative
Imperative
Imperative defines computation as statements that change a program state
Imperative
Imperative
Functional
Functional treats computation as the evaluation of mathematical functions and
avoids state and mutable data
Functional treats computation as the evaluation of mathematical functions and
avoids state and mutable data
Functional treats computation as the evaluation of mathematical functions and
avoids state and mutable data
Functional
Functional
Functional
Functional
Functional
Functional
None
Concurrency
Threads
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Java = Imperative
Thread and Locks I don't know the answer
Thread and Locks Mutable State
Thread and Locks Race condition
Race Condition the output is dependent on the sequence or
timing of other uncontrollable events
Thread and Locks The meaning of life is: 0
None
Thread and Locks The meaning of life is: 0
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks
Thread and Locks Optimization
Optimization the compiler is allowed to statically optimize your code
by reordering things
Optimization the compiler is allowed to statically optimize your code
by reordering things
Optimization the JVM is allowed to dynamically optimize your code
by reordering things
Optimization the JVM is allowed to dynamically optimize your code
by reordering things
Optimization the hardware you’re running on is allowed to optimize
performance by reordering things
Optimization the hardware you’re running on is allowed to optimize
performance by reordering things
Imperative
Imperative Thread Pool Mutual Exclusion Mutiple Locks - Deadlock Excessive
Contention
Functional
Functional treats computation as the evaluation of mathematical functions and
avoids state and mutable data
Functional treats computation as the evaluation of mathematical functions and
avoids state and mutable data
Functional treats computation as the evaluation of mathematical functions and
avoids state and mutable data
Functional - Bound/Unbound Variable
Functional - Bound/Unbound Variable
Functional - Bound/Unbound Variable
Functional - Bound/Unbound Variable
Functional - Bound/Unbound Variable
Determinism
Determinism - Same In => Same out f(x)
Determinism - Same In => Same out no disk I/O
f(x)
Determinism - Same In => Same out no disk I/O
no random() f(x)
Determinism - Same In => Same out no disk I/O
no side effects no random() always the same result f(x)
Determinism - Same In => Same out no disk I/O
no side effects no random() f(x)
Determinism
Determinism
Determinism 42
Determinism
Determinism + Concurrency
Determinism + Concurrency
Determinism + Concurrency
Determinism + Concurrency
Determinism + Concurrency
Concurrency Models
Actor
Actor
Actor An object which encapsulates state and communicates with other
actors by exchaging messages
Actor accumulator
Actor accumulator
Goroutines and Channels
Goroutines and Channels
Microthreads with a internal scheduler Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
Goroutines and Channels
References
References
References
THANK YOU! @Scalone