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
My Mom told me that Ruby isn't thread-safe
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Smit Shah
November 16, 2013
Programming
140
0
Share
My Mom told me that Ruby isn't thread-safe
Smit Shah
November 16, 2013
More Decks by Smit Shah
See All by Smit Shah
Resillent By Design
who828
0
140
How does Bundler bundle?
who828
0
140
KDE is unlike a coconut
who828
0
130
Other Decks in Programming
See All in Programming
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
5
1k
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
420
Modding RubyKaigi for Myself
yui_knk
0
860
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
120
Moments When Things Go Wrong
aurimas
3
140
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
210
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
120
初めてのRubyKaigiはこう見えた
jellyfish700
0
400
Migrations : C'est une question d'hygiène !
vinceamstoutz
0
2.9k
GitHub Copilot CLIのいいところ
htkym
2
1.2k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
230
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.5k
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
200
A Tale of Four Properties
chriscoyier
163
24k
Visualization
eitanlees
152
17k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Music & Morning Musume
bryan
47
7.2k
Unsuck your backbone
ammeep
672
58k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Test your architecture with Archunit
thirion
1
2.3k
Un-Boring Meetings
codingconduct
0
300
Abbi's Birthday
coloredviolet
2
7.8k
Designing for Performance
lara
611
70k
HDC tutorial
michielstock
2
680
Transcript
Ruby my me told mom that isn’t thread-safe
SHE WAS RIGHT and I was left
Smit Shah github.com/who828 twitter.com/who828
Concurrency? what is
1.Concurrency is about dealing with lots of things at once
like dealing with this exam paper
2.Concurrency is about context switching
like attempting another question! in case you’re stuck
SQL Controller Render Response Controller SQL Response Render Without concurrency
in your web server Request 1 Request 2
SQL Controller Render Response Controller SQL Response Render With concurrency
in your web server Request 1 Request 2
Ruby supports concurrency through threads
Ruby supports concurrency through threads *conditions apply
Parallelism? what is
1.Parallelism is about doing lots of things at once
it’s like getting your friend to write the exam,! while
you go watch a movie
2.No one can guarantee that your code will run in
parallel.
aside from Rajnikanth
and the kernel scheduler
Ruby ! doesn’t support parallelism through threads
use JRuby Ways to achieve parallelism
this JRuby disclaimer is brought to you by Flipkart
use JRuby Ways to achieve parallelism use :(){ :|:& };:
Thread-safety? what about
None
(the rainbows are just to make it hurt less)
“gee, I don’t really need to care about thread-safety because
of the GIL”
“gee, I don’t really need to care about thread-safety because
of the GIL”
About the GIL few words
Managing thread-safety
Managing thread-safety get drunk and forget about it
Managing thread-safety get drunk and forget about it avoid global
mutations
Managing thread-safety get drunk and forget about it avoid global
mutations prefer thread-locals
Managing thread-safety get drunk and forget about it avoid global
mutations prefer thread-locals use the right data structures
Managing thread-safety get drunk and forget about it avoid global
mutations prefer thread-locals use the right data structures just learn about functional programming already
Bundler example
Pepperidge Farm wants you to remember
“The Only Sure Thing in Computer Science, Everything is a
tradeoff” – Van Roy and Haridi, Concepts, Techniques, and Models of Computer Programming
thanks!