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
AWS Network Firewall Proxyで脱Squid運用⁈
nnydtmg
1
160
GitHub Copilot CLI 現状確認会議
torumakabe
12
4.4k
Databricks Free Edition講座 データエンジニアリング編
taka_aki
0
2.8k
ドメイン駆動セキュリティへの道しるべ
pandayumi
0
180
ビジュアルプログラミングIoTLT vol.22
1ftseabass
PRO
0
140
Hardware/Software Co-design: Motivations and reflections with respect to security
bcantrill
1
250
Security Hub と出会ってから 1年半が過ぎました
rch850
0
180
なぜCREを8年間続けているのか / cre-camp-4-2026-01-21
missasan
0
1.3k
習慣とAIと環境 — 技術探求を続ける3つの鍵
azukiazusa1
3
760
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
クラウドセキュリティの進化 — AWSの20年を振り返る
kei4eva4
0
160
SwiftDataを覗き見る
akidon0000
0
310
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
1
220
A Tale of Four Properties
chriscoyier
162
24k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
160
New Earth Scene 8
popppiees
1
1.4k
Design in an AI World
tapps
0
130
Mobile First: as difficult as doing things right
swwweet
225
10k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
430
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
180
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
900
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
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