$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go Scheduler
Search
Cyril Lashkevich
July 21, 2017
Technology
2
610
Go Scheduler
GoWayFest 2017
Cyril Lashkevich
July 21, 2017
Tweet
Share
More Decks by Cyril Lashkevich
See All by Cyril Lashkevich
Bitcode in Swift
notorca
0
54
Mobile Optimized 2014
notorca
1
260
Fun with blocks in ObjC
notorca
1
97
CocoaHeads in Grodno, Lighting
notorca
0
82
Dictionary in Python
notorca
0
120
Foundation data structures
notorca
0
140
iOS memory management
notorca
0
90
NSProxy, multithreading, messaging
notorca
1
100
Python impergections
notorca
0
85
Other Decks in Technology
See All in Technology
日本Rubyの会: これまでとこれから
snoozer05
PRO
4
190
AIBuildersDay_track_A_iidaxs
iidaxs
3
370
WordPress は終わったのか ~今のWordPress の制作手法ってなにがあんねん?~ / Is WordPress Over? How We Build with WordPress Today
tbshiki
2
850
Kiro を用いたペアプロのススメ
taikis
3
900
AI 駆動開発勉強会 フロントエンド支部 #1 w/あずもば
1ftseabass
PRO
0
410
Jakarta Agentic AI Specification - Status and Future
reza_rahman
0
110
品質のための共通認識
kakehashi
PRO
4
390
MariaDB Connector/C のcaching_sha2_passwordプラグインの仕様について
boro1234
0
930
ペアーズにおけるAIエージェント 基盤とText to SQLツールの紹介
hisamouna
2
850
まだ間に合う! Agentic AI on AWSの現在地をやさしく一挙おさらい
minorun365
14
1.5k
AWSを使う上で最低限知っておきたいセキュリティ研修を社内で実施した話 ~みんなでやるセキュリティ~
maimyyym
2
1.8k
20251218_AIを活用した開発生産性向上の全社的な取り組みの進め方について / How to proceed with company-wide initiatives to improve development productivity using AI
yayoi_dd
0
280
Featured
See All Featured
Google's AI Overviews - The New Search
badams
0
860
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
62
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
240
Deep Space Network (abreviated)
tonyrice
0
18
The SEO identity crisis: Don't let AI make you average
varn
0
32
The agentic SEO stack - context over prompts
schlessera
0
550
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
400
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
67
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
67
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
286
14k
The Limits of Empathy - UXLibs8
cassininazir
1
190
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
83
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/