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
Go Scheduler
Search
Cyril Lashkevich
July 21, 2017
Technology
630
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go Scheduler
GoWayFest 2017
Cyril Lashkevich
July 21, 2017
More Decks by Cyril Lashkevich
See All by Cyril Lashkevich
Bitcode in Swift
notorca
0
75
Mobile Optimized 2014
notorca
1
280
Fun with blocks in ObjC
notorca
1
110
CocoaHeads in Grodno, Lighting
notorca
0
97
Dictionary in Python
notorca
0
130
Foundation data structures
notorca
0
170
iOS memory management
notorca
0
120
NSProxy, multithreading, messaging
notorca
1
110
Python impergections
notorca
0
98
Other Decks in Technology
See All in Technology
SONiCのLinuxベースを活かしたZabbix監視
sonic
0
180
非エンジニアがClaudeと挑んだ「1ヶ月間プロダクト30本ノック」
askokc
0
600
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
160
AIの性能が向上しても未解決な組織の重大問題は何か?/An Unsolved Organizational Problem in the Age of AI
moriyuya
4
680
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
140
Disciplined Vibes: Scaling AI-Assisted Engineering
sheharyar
0
150
2026年6月23日 Syncable Tech + Start Python Club にて
hamukazu
0
120
2026 TECHFRESH 畢業分享會 - AI-Native 重塑軟體工程與虛擬講師
line_developers_tw
PRO
0
1.1k
Claude Codeをどのように キャッチアップしているか
oikon48
13
8.3k
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
150
SONiCで構築・運用する生成AI向けパブリッククラウドネットワーク ~実装編~
sonic
0
230
フィジカル版Github Onshapeの紹介
shiba_8ro
0
270
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
390
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
230
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
The Curse of the Amulet
leimatthew05
1
13k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
460
Paper Plane (Part 1)
katiecoart
PRO
0
9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
How to build a perfect <img>
jonoalderson
1
5.7k
Marketing to machines
jonoalderson
1
5.5k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Transcript
Go Scheduler Cyril Lashkevich GoWayFest 2017
Планировщик главное отличие go от современных mainstream языков В остальном
это Pascal c GC
func main() { var x int threads := runtime.GOMAXPROCS(0) for
i := 0; i < threads; i++ { go func() { for { x++ } }() } time.Sleep(time.Second) fmt.Println("x =", x) }
func test() { a := 100 for i := 1;
i < 1000; i++ { a = i*100/i + a } } func main() { runtime.GOMAXPROCS(1) go func() { for { test() } }() time.Sleep(100 * time.Millisecond) fmt.Println("hello world") }
runtime: tight loops should be preemptible #10958 aclements opened this
issue on May 26, 2015 · 50 comments
Конкурентность и языки Язык Отображение на системные потоки Lua none
C, C++, Python 1:1 Java <= 1.1, j2me, Python n:1 Go, Erlang n:m
Goroutines VS threads Свойство Goroutines Threads Время создания Быстро Медленно
Время удаления Быстро Медленно Переключение контекста Быстро Медленно Потребление памяти под стек 2kB 512kB-1MB Допустимое количество 10^4 10^6
Вытесняющая и кооперативная многозадачность
Планировщики — Work Sharing при появлении новой задачи попытаться мигрировать
ее на свободный процессор — Work Stealing когда процессор освобождается, он пытается найти себе задачу
Scheduling Multithreaded Computations by Work Stealing
G M P — G - Goroutine — M -
OS thread — P - "Processor"
None
None
None
None
GOMAXPROCS Просто количество P
Spining threads — M с P ищет G — M
без P ищет P — Есть готовая к исполнению G, свободная P, но нет M
None
Когда происходит переключение goroutines — morestack() --> newstack() — runtime.Gosched()
— locks — network I/O — syscalls
GOEXPERIMENT = preemptibleloops
Влияние на GC GC не может работать пока есть невытесняемая
goroutine
https://morsmachine.dk/go-scheduler https://rakyll.org/scheduler/ https://github.com/golang/go/blob/master/src/runtime/ proc.go https://docs.google.com/document/d/ 1TTj4T2JO42uD5ID9e89oa0sLKhJYD0Y_kqxDv3I3XMw https://github.com/golang/go/issues/10958 https://github.com/golang/go/issues/16051 https://github.com/golang/go/issues/17831 https://www.slideshare.net/matthewrdale/demystifying-
the-go-scheduler https://povilasv.me/go-scheduler/