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
Of concurrency and other demons
Search
Rodrigo Graciano
January 16, 2021
Technology
150
0
Share
Of concurrency and other demons
Talk about concurrency.
Initially presented at DawsCon with Hillmer Chona
Rodrigo Graciano
January 16, 2021
More Decks by Rodrigo Graciano
See All by Rodrigo Graciano
Advancing with Java
graciano
0
24
Your Java isn't the same
graciano
0
220
Cloud Batch
graciano
0
180
Batch Processing
graciano
0
410
Java 9 ao 17 - Oracle no TDC
graciano
0
130
KnoxJava - Java 9-17
graciano
0
170
Java 9 to Java 16: A review of recent changes to the language
graciano
0
160
Java 9 ao 15 - Evolução da Linguagem Java
graciano
0
290
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
Oracle Cloud Infrastructure:2026年3月度サービス・アップデート
oracle4engineer
PRO
0
380
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
170
Databricks Lakehouse Federationで 運用負荷ゼロのデータ連携
nek0128
0
110
最大のアウトプット術は問題を作ること
ryoaccount
0
300
BIツール「Omni」の紹介 @Snowflake中部UG
sagara
0
150
プロダクトを育てるように生成AIによる開発プロセスを育てよう
kakehashi
PRO
1
440
レガシーシステムをどう次世代に受け継ぐか
tachiiri
0
250
来期の評価で変えようと思っていること 〜AI時代に変わること・変わらないこと〜
estie
0
140
パワポ作るマンをMCP Apps化してみた
iwamot
PRO
0
300
20260326_AIDD事例紹介_ULSC.pdf
findy_eventslides
0
500
Cortex Codeでデータの仕事を全部Agenticにやりきろう!
gappy50
0
290
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
670
Accessibility Awareness
sabderemane
0
92
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
440
How to Ace a Technical Interview
jacobian
281
24k
Building an army of robots
kneath
306
46k
The Curse of the Amulet
leimatthew05
1
11k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
We Have a Design System, Now What?
morganepeng
55
8.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Transcript
None
➔ Software developer - Team lead ➔ Java Champion ➔
Medellin Java Users Group Leader ➔ hibernate/hibernate-validator Contributor ➔ Duke’s Choice Award Winner ➔ Eclipse Collections contributor
➔ Professional with 10+ years ➔ Principal Software Engineer -
NY ➔ NYJavaSIG Leader ➔ graciano.dev ➔ Twitter: @rodrigograciano
• • • •
• Concurrency when we have many task, largely independent, and
we use the same resource to do them at a time • Parallelism is when we want to do one task, and we split up in multiple subtasks
A Thread is an independent path of execution that allows
a program to operate more efficiently by doing multiple things at the same time. Threads can be used to perform complicated tasks in the background without interrupting the main program.
• Synchronous: when we wait to finish a task before
moving to the next one • Asynchronous: when we move to another task before it finishes
• Thread t = new Thread( ()-> this.doSomething( thing ));
t.start(); • ExecutorService executor = Executors.newFixedThreadPool( 10 ); Future<?> future = executor.submit( ()-> this.doSomething( thing )); • CompletableFuture.runAsync( ()-> this.doSomething( thing )); • Thread.builder().virtual().name("name").task(() -> this.doSomething( thing )).start();
None
None
Stream API CompletableFuture Creation Chained operations Return forEach runAsync thenAccept
/ thenRun void map supplyAsync thenApply CompletableFuture<U>
None
CompletableFuture<Void>::runAsync (Runnable runnable) <U> CompletableFuture<U>::supplyAsync (Supplier<U> supplier) CompletableFuture<Void>::runAsync (Runnable runnable,
Executor executor) <U> CompletableFuture<U>::supplyAsync (Supplier<U> supplier, Executor executor)
static ExecutorService newCachedThreadPool() static ExecutorService newFixedThreadPool (int nThreads) static ScheduledExecutorService
newScheduledThreadPool (int corePoolSize) static ExecutorService newSingleThreadExecutor() static ScheduledExecutorService newSingleThreadScheduledExecutor() static ExecutorService newWorkStealingPool()
T::get () throws InterruptedException , ExecutionException T::get (long timeout, TimeUnit
unit) throws InterruptedException , ExecutionException , TimeoutException T::getNow (T valueIfAbsent) T::join()
• • • •