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
Core.async
Search
Peter Brachwitz
September 18, 2014
Programming
0
57
Core.async
Introduction to core.async with some remarks on concurrency models in general
Peter Brachwitz
September 18, 2014
Tweet
Share
More Decks by Peter Brachwitz
See All by Peter Brachwitz
Om/React.js/Clojurescript: An introduction
pebrc
1
290
Introduction to Clojure for Java Devs
pebrc
1
71
Other Decks in Programming
See All in Programming
Developer Joy - The New Paradigm
hollycummins
1
380
AI駆動で0→1をやって見えた光と伸びしろ
passion0102
1
880
Go言語はstack overflowの夢を見るか?
logica0419
0
650
ドメイン駆動設計のエッセンス
masuda220
PRO
15
6k
KoogではじめるAIエージェント開発
hiroaki404
1
140
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
2
380
技術的負債の正体を知って向き合う
irof
0
290
CSC305 Lecture 10
javiergs
PRO
0
310
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
7
3.6k
ALL CODE BASE ARE BELONG TO STUDY
uzulla
28
6.8k
CSC305 Lecture 08
javiergs
PRO
0
280
Google Opalで使える37のライブラリ
mickey_kubo
3
160
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
8.9k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Producing Creativity
orderedlist
PRO
348
40k
Code Reviewing Like a Champion
maltzj
526
40k
YesSQL, Process and Tooling at Scale
rocio
173
15k
How to Ace a Technical Interview
jacobian
280
24k
Building an army of robots
kneath
306
46k
Visualization
eitanlees
150
16k
Typedesign – Prime Four
hannesfritz
42
2.8k
A Modern Web Designer's Workflow
chriscoyier
697
190k
A designer walks into a library…
pauljervisheath
209
24k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Transcript
CORE.ASYNC WITH SOME REMARKS ON CONCURRENCY MODELS IN GENERAL /
Peter Brachwitz @p_brc
AGENDA 1. Popular concurrency models in comparison [15 min.] 2.
A taste of core.async [15 min]
WHY? We want to be more 'reactive' (we can discuss
whether 'reactive' is a 'thing' later) We want to make use of our multi-core hardware Low-level concurrency is hard
WHAT? Definitions: Concurrency vs. parallelism and what about multi-core Here:
'processes' working together in a meaningful manner
APPROACHES TO CONCURRENT PROGRAMMING 1. Shared memory: Threads and locks
* 2. Message passing: 1. Actors 2. CSP
WHAT NOT (TODAY)? Refs Atoms Agents Futures, Delays
SHARED MEMORY, THREADS AND LOCKS 'Location based programming' (R. Hickey)
Naive approaches don't scale very well. Think: web server using a thread per request. Hard to reason about, error-prone
MITIGATION: EVENT-LOOP ARCHITECTURE Single-threaded, non-blocking Handle blocking or time-consuming computations
in different execution contexts Handle the completion of these computations via callbacks (callback hell)
THE ACTOR MODEL [originally] Hewitt, Bishop, Steiger 1973
'Objects' communicating via messages Sequencing of messages via actor-local queues
('mailbox') You need to know your peer No inherent back-pressure (can be implemented on application level)
CSP [originally] Hoare 1978
CSP in core.async flavour Channels as conveyor belts between 'processes'
Sequential looking asynchrony via go blocks Channels are bounded: back pressure Not for distributed computing: everything within one VM
COMPARISON WITH ACTOR SYSTEMS Anonymity vs. Identity Rendezvous vs. Asynchrony
Explicit vs. implicit 'channels' Local vs. Distributed
LET'S LOOK AT SOME CODE!
SOURCES core.async on Github Tim Baldrige's Clojure Conj 2013 talk
Rich Hickey speaking at Strange Loop 2013 Gul Agha's dissertation