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
Parallel Computing in Go
Search
Fabian Becker
November 17, 2012
Technology
2
230
Parallel Computing in Go
Fabian Becker
November 17, 2012
Tweet
Share
Other Decks in Technology
See All in Technology
Windows 11 version 25H2 への準備はできていますか?
tamaiyutaro
1
160
Enhancing Application Modernization Experience with AIDLC
humank
1
150
HyperCard温故知新 / iOSDC Japan 2025
genda
0
110
High performance GIF playback/iOSDC25
noppefoxwolf
1
130
DEFCON CHV CTF 2025 Write-up
bata_24
0
150
低リスクで小学生男児を鍵っ子にする 俺の勉強会#4
inakaphper
0
200
生成AI活用のベストプラクティス集を作ってる件
asei
1
340
20250924_LT2本やる.pdf
foursue
0
760
AIエージェントがアプリケーション開発の未来を変える
nagix
3
1.1k
iOSDC2025 みてねiOSアプリにおける バックグラウンドアップロード継続の挑戦
hikarusato
2
540
mypyの10年、pyrightの5年 tyの挑戦 - 型チェッカー進化論 -
byfarsmall
0
120
入門 FormObject / An Introduction to FormObject #kaigionrails
expajp
2
770
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
How to Think Like a Performance Engineer
csswizardry
27
2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
Code Review Best Practice
trishagee
72
19k
Facilitating Awesome Meetings
lara
56
6.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
114
20k
Navigating Team Friction
lara
189
15k
Thoughts on Productivity
jonyablonski
70
4.8k
Context Engineering - Making Every Token Count
addyosmani
3
120
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Transcript
Parallel Computation in Go Fabian Becker @geekproject
/me Open Source /me Piwik geekmonkey.org Ruby Evolutionary Algorithms Go
Why Go? • Why not? • C/C++ sucks • Distributed
systems • Multicore hardware
What does it offer? • lightweight syntax • statically typed
• garbage-collected (yay!) • concurrent • compiles to machine code
Anything else? • free and open source • enforced code
style • duck typing (type inference) • static typing • fast
Example import ( “fmt” ”http” ) func handler(c *http.Conn, r
*http.Request) { fmt.Fprintf(c, “Hello, %s\n”, r.URL.Path[1:]) } func main() { http.ListenAndServe(“:8080”, http.HandlerFunc(handler)) }
Concurrency • Communicating Sequential Processes – Hoare, 1978 • Goroutines
– Lighter than Threads – 100.000s – Channels • “Don't communicate by sharing memory; share memory by communicating.”
Example #1 var a string func f() { a =
“Hello World” } func main() { go f() println(a) }
Example #2 var c = make(chan int, 1) var a
string func f() { a = "hello, world" c < 0 } func main() { go f() <c print(a) }
Goroutines • Run on a set of threads • Ordinary
functions (coroutines) – “go” keyword • Blocking – System calls block – Handled by the scheduler – Non-blocked routines moved to another thread • Memory efficient!
Channels • Typed • “<-” operator channel := make(chan string)
• Worker function declaration: func worker(input string, results chan< string) { // do work results < result }
Channels #2 // A typed queue c := make(chan int)
// Buffered vs. unbuffered unbuf := make(chan int) buf := make(chan int, 100) // Send to a channel c < 10 // Receive from a channel i := <c
Testing • Go comes with a lightweight test suite –
“go test” • Automated tests are great! func TestFoo(t *testing.T) { ... }
Benchmarking • Benchmark all the things! func BenchmarkHello(b *testing.B) {
for i := 0; i < b.N; i++ { fmt.Sprintf("hello") } } • Nice for optimizing critical sections of your code
Who uses Go? • Google (No shit Sherlock!) • CloudFlare
• Heroku • SoundCloud • Novartis • ...
Thanks for attending! Questions?
Resources • http://godashboard.appspot.com/ • https://gobyexample.com/ • http://golang.org • http://areyoufuckingcoding.me/topic/golang •
http://geekmonkey.org/articles/20- comparison-of-ides-for-google-go