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
gh_extensionsによる快適なOSS生活.pdf
sivchari
0
5
Visualization Go scheduler by gosched-simulator
sivchari
0
130
protoc pluginのはじめかた
sivchari
0
17
What's context package
sivchari
0
18
Dive into arena package ~ Go 1.20 release party ~
sivchari
0
39
GopherCon 2023 recap
sivchari
0
17
Go 1.22 range over func/range over int
sivchari
0
26
Deep dive into runtime features provided by Go1.22
sivchari
0
17
Go 1.22で追加予定 だった zeroの紹介 Go Conference mini
sivchari
0
300
Featured
See All Featured
A better future with KSS
kneath
238
17k
How to Ace a Technical Interview
jacobian
276
23k
KATA
mclloyd
29
14k
Rails Girls Zürich Keynote
gr2m
94
13k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
860
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
Bash Introduction
62gerente
610
210k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
173
51k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
The Invisible Side of Design
smashingmag
299
50k
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Λࢧ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ΔHMPCBMRVFVF sched
~goroutineͷϥΠϑλΠϜ~
αϯϓϧίʔυ
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~