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
Smit Shah
November 16, 2013
Programming
0
130
My Mom told me that Ruby isn't thread-safe
Smit Shah
November 16, 2013
Tweet
Share
More Decks by Smit Shah
See All by Smit Shah
Resillent By Design
who828
0
130
How does Bundler bundle?
who828
0
130
KDE is unlike a coconut
who828
0
120
Other Decks in Programming
See All in Programming
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
今、知っておきたい! 生成AIエージェントの世界
elith
3
350
データアナリストが行うDatabricksを活用したETLの自動化事例
shinoa
0
260
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
640
Fragment Composition of GraphQL
quramy
3
610
Elm 0.19.0 Changes
bkuhlmann
0
490
Goのmultiple errorsについて (2024年4月版)
syumai
3
590
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
900
Rubyでたのしむクリエイティブコーディング/Enjoy Creative coding with Ruby
chobishiba
1
180
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
300
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
530
Changed Rules: Architectures with Lightweight Stores
manfredsteyer
PRO
0
240
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
331
56k
Infographics Made Easy
chrislema
238
18k
Web Components: a chance to create the future
zenorocha
305
41k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Designing with Data
zakiwarfel
96
4.8k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
The Invisible Customer
myddelton
114
12k
In The Pink: A Labor of Love
frogandcode
138
21k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
Designing Experiences People Love
moore
136
23k
The Invisible Side of Design
smashingmag
294
49k
Side Projects
sachag
451
41k
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!