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
goroutineの仕組みについて
Search
sivchari
November 13, 2021
0
1.4k
goroutineの仕組みについて
Go Conference 2021 Autumnで発表した資料です
sivchari
November 13, 2021
Tweet
Share
More Decks by sivchari
See All by sivchari
protoc pluginのはじめかた
sivchari
0
2
What's context package
sivchari
0
14
Dive into arena package ~ Go 1.20 release party ~
sivchari
0
31
GopherCon 2023 recap
sivchari
0
15
Go 1.22 range over func/range over int
sivchari
0
21
Deep dive into runtime features provided by Go1.22
sivchari
0
16
Go 1.22で追加予定 だった zeroの紹介 Go Conference mini
sivchari
0
290
Dive into testing package ~ Part of Fuzzing Test ~
sivchari
1
230
database/sqlの仕組みについて
sivchari
0
170
Featured
See All Featured
Optimizing for Happiness
mojombo
376
70k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Fireside Chat
paigeccino
34
3.1k
The Cult of Friendly URLs
andyhume
78
6.1k
A designer walks into a library…
pauljervisheath
204
24k
Agile that works and the tools we love
rasmusluckow
328
21k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
GitHub's CSS Performance
jonrohan
1030
460k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The World Runs on Bad Software
bkeepers
PRO
65
11k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Adopting Sorbet at Scale
ufuk
73
9.1k
Transcript
goroutineͷΈʹ͍ͭͯ ~Go Conference 2021 Autumn~
w 5BLVNB4IJCVZB!TJWDIBSJ w ଔ$ZCFS"HFOU ༧ఆ w όοΫΤϯυΤϯδχΞ w MJOUFS
044͕͖ ࣗݾհ
w (PͷSVOUJNFΛࢧ͑Δཁૉ w HPSPVUJOFͷϥΠϑλΠϜ w HPSPVUJOFͷεέδϡʔϦϯά ͢͜ͱ
~Let's Go~
~GoͷruntimeΛࢧ͑Δཁૉ~
w (HPSPVUJOF w .ϚγϯεϨου w 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~
αϯϓϧίʔυ
newproc . 1 ( SVOR $SFBUFHPSPVUJOF
newproc1 ( . 1 ( SVOR
newproc ( . 1 ( SVOR
runqput ( . 1 ( SVOR (
runqputslow TDIFE . 1 ( SVOR (
globruqputbatch TDIFE . 1 ( SVOR ( (
~goroutineͷεέδϡʔϦϯά~
schedule TDIFE . 1 ( SVOR (
globrunqget TDIFE ( . 1 ( SVOR (
schedule . 1 ( SVOR (
runqget ( . 1 ( SVOR (
schedule . 1 ( SVOR
fi ndrunnable ( *0 ❌ @(XBJUJOH@(SVOOBCMF ( . 1
( SVOR
1 . ( SVOR 1 . ( SVOR (
( ( ( ( ( fi ndrunnable
stealWork/runqsteal 1 . ( SVOR 1 ( SVOR (
( ( ( ( ( ( ( ( .
execute ( . 1 ( SVOR
goexit ( . 1 ( SVOR
goexit1 ( . 1 ( SVOR
mcall ( . 1 ( SVOR
UPHGSFF goexit0 ( . 1 ( SVOR
αϯϓϧίʔυ IUUQTQMBZHPMBOHPSHQX81SL$YO)G
w (PಠࣗͷεέδϡʔϥʔͰHPSPVUJOFΛ੍ޚ͍ͯ͠Δ w ֤1͕SVORΛ࣋ͭ͜ͱͰϓϩάϥϜͷޮ͕ߴ·Δ w ෳࡶͳ࣮ͷ͓͔͛Ͱ؆୯ʹฒߦॲཧΛ࣮Ͱ͖Δ ·ͱΊ
~Tank you for watching~