Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
select文の内部実装見つけました
H.Saki
August 11, 2021
Technology
1
420
select文の内部実装見つけました
21/8/11 GeekGig #1 〜Goと私の一年〜にて発表
https://showcase-gig.connpass.com/event/217914/
H.Saki
August 11, 2021
Tweet
Share
More Decks by H.Saki
See All by H.Saki
アプリ側のコードを書いていた人がLambdaに触れて気づいたこと
sakiengineer
0
700
epollによるNetwork I/O in Goランタイム
sakiengineer
2
1.2k
スケジューラから学ぶGoランタイム 〜code reading of runtime pkg〜
sakiengineer
8
3.1k
Other Decks in Technology
See All in Technology
Data in Google I/O - IO Extended GDG Seoul
kennethanceyer
0
150
Istio入門
nutslove
15
4.9k
JFrog 最新情報 - JFrog DevOps プラットフォームの今までとこれから / jfrog-update-for-devopskaigi-2022
tsuyo
0
150
アーキテクチャを明文化して開発に臨んだ話
akihiyo76
0
260
要約 "Add Live Text interaction to your app"
ushisantoasobu
0
140
UWBを使ってみた
norioikedo
0
400
Target SDK Versionを上げない Notification runtime permission対応
napplecomputer
0
130
Design for Humans: How to make better modernization decisions
indualagarsamy
2
110
サイボウズの アジャイル・クオリティ / Agile Quality at Cybozu
cybozuinsideout
PRO
4
2.1k
Scrum Fest Osaka 2022 段階的スクラムマスターのススメ
orimomo
0
710
JUnit5.7, 5.8の新機能紹介 #jjug_ccc #jjug_ccc_b / junit 5.7, 5.8 new features
kyonmm
PRO
2
410
2022年度新卒技術研修「エンジニアマインド」講義
excitejp
PRO
0
370
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
15
940
The Brand Is Dead. Long Live the Brand.
mthomps
46
2.7k
The Mythical Team-Month
searls
209
39k
Typedesign – Prime Four
hannesfritz
33
1.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
655
120k
The Straight Up "How To Draw Better" Workshop
denniskardys
225
120k
Six Lessons from altMBA
skipperchong
14
1.4k
Visualization
eitanlees
124
11k
Code Reviewing Like a Champion
maltzj
506
37k
How STYLIGHT went responsive
nonsquared
85
3.9k
Done Done
chrislema
174
14k
Bootstrapping a Software Product
garrettdimon
296
110k
Transcript
select文の内部実装見つけました GeekGig #1, AUG 11 2021 さき(H.Saki) @saki-engineer
About Me 自己紹介 l ͖͞ )4BLJ ◦ ౦େֶ෦ ˠ ࠓ͔Β৽ࣾձਓ
ݚमத ◦ 5XJUUFS!TBLJFOHJOFFS l աڈͷՌ FUDʜ
TFMFDUจͰɺதʹDBTFจΛॻ͘͜ͱͰॲཧͷذΛ࣮ݱ͍ͯ͠Δɻ Select statements select文 var i1, i2 int var ch1,
ch2 chan int select { case i1 = <-ch1: print("received ", i1, " from c1∖n") case ch2 <- i2: print("sent ", i2, " to c2∖n") default: print("no communication∖n") } νϟωϧDI͔Βͷड৴͕Մೳͳͱ͖࣮ߦ νϟωϧDIͷૹ৴͕Մೳͳͱ͖࣮ߦ ͍ͣΕͰͳ͍߹ʹ࣮ߦ EFGBVMUDBTF͕ͳ͚ΕϒϩοΫ
runtime/select.go runtime/select.go ߦʹʮ͜ͷϑΝΠϧʹTFMFDUจͷؚ࣮͕·Ε͍ͯ·͢ʯͱͷهࡌ͋Γ
runtime/select.go runtime/select.go TFMFDUจຊମͷهड़ɺ-ͷ GVOD TFMFDUHP ͰߦΘΕ͍ͯΔɻ // selectgo implements the
select statement. func selectgo(cas0 *scase, order0 *uint16, pc0 *uintptr, nsends, nrecvs int, block bool) (int, bool) { // (略) // 400行くらいある }
None
ͪΐͬͱԿݴͬͯΔ͔Θ͔Μͳ͍
͜Μͳͱ͖ίϝϯτʹண͠Α͏ʂ
Implementation of select statement select文の実装 ϒϩοΫ͠ͳͯ͘Α͍߹͔Β࣮͍ͯ͠Δ͜ͱ͕֬ೝͰ͖Δɻ TFMFDU͢Δରͷத͔Βૹड৴Ͱ͖Δ νϟωϧ͕ͳ͍͔Λ୳͍ͯ͠ΔͬΆ͍ l νϟωϧ͔Βड৴ՄˠSFDW
l όοϑΝ͔Βड৴ՄˠCVGSFDW l νϟωϧDMPTFࡁΈˠSDMPTF ͔ͳʁͱ͍͏Ծઆ͕༰қʹཱͭ
Implementation of select statement select文の実装 ͦͷ࣍ʹɺϒϩοΫʹೖΔ߹ͷॲཧΛॻ͍͍ͯΔɻ ૹड৴Ͱ͖Δνϟωϧ͕ͳ ͔ͬͨͱ͖ͷॲཧ͔ͳʁ HPQBSLؔͰҎԼͷॲཧΛ࣮ߦ͠ɺTFMFDUจͷCMPDLΛ࣮ݱ
TFMFDUจΛ࣮ߦ͍ͯ͠Δΰʔϧʔνϯͷঢ়ଶΛSVOOJOH͔ΒXBJUJOHʹมߋ ֘ΰʔϧʔνϯΛεϨου͔ΒҰ୴Γ͢
Summary まとめ l TFMFDUจຊମͷ࣮SVOUJNFTFMFDUHPͷதͷTFMFDUHPؔ ◦ େମͷ(PͷجװػೳSVOUJNFύοέʔδͷதʹ͋Δ l ίʔυΛૉʹಡΈղ͔ͳͯ͘ɺ࣮ͷେΛ୳Δ͜ͱͰ͖Δ ख͕͔ΓʹͳΔͷҎԼ ◦
ίϝϯτ ◦ มɾఆɾ໊ؔ ◦ ߏମͷϑΟʔϧυ໊ ◦ ϥϕϧ໊ l ΈΜͳSVOUJNFύοέʔδΛಡ͏;&ˑ
5IBOLZPVGPSMJTUFOJOH