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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Cyril Lashkevich
July 21, 2017
Technology
620
2
Share
Go Scheduler
GoWayFest 2017
Cyril Lashkevich
July 21, 2017
More Decks by Cyril Lashkevich
See All by Cyril Lashkevich
Bitcode in Swift
notorca
0
62
Mobile Optimized 2014
notorca
1
270
Fun with blocks in ObjC
notorca
1
100
CocoaHeads in Grodno, Lighting
notorca
0
86
Dictionary in Python
notorca
0
130
Foundation data structures
notorca
0
150
iOS memory management
notorca
0
93
NSProxy, multithreading, messaging
notorca
1
110
Python impergections
notorca
0
92
Other Decks in Technology
See All in Technology
GitHub Actions侵害 — 相次ぐ事例を振り返り、次なる脅威に備える
flatt_security
11
6.9k
AIにより大幅に強化された AWS Transform Customを触ってみる
0air
0
230
FastMCP OAuth Proxy with Cognito
hironobuiga
3
230
CloudFrontのHost Header転送設定でパケットの中身はどう変わるのか?
nagisa53
1
230
40代からのアウトプット ― 経験は価値ある学びに変わる / 20260404 Naoki Takahashi
shift_evolve
PRO
2
360
「できない」のアウトプット 同人誌『精神を壊してからの』シリーズ出版を 通して得られたこと
comi190327
3
390
20260323_データ分析基盤でGeminiを使う話
1210yuichi0
0
210
FlutterでPiP再生を実装した話
s9a17
0
240
自分をひらくと次のチャレンジの敷居が下がる
sudoakiy
2
960
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
640
Kiro Meetup #7 Kiro アップデート (2025/12/15〜2026/3/20)
katzueno
2
270
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
670
Featured
See All Featured
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
250
Git: the NoSQL Database
bkeepers
PRO
432
67k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
Accessibility Awareness
sabderemane
0
88
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
200
The Limits of Empathy - UXLibs8
cassininazir
1
280
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
460
Thoughts on Productivity
jonyablonski
75
5.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
500
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
140
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/