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
今日から始めるAmazon Bedrock AgentCore
har1101
4
390
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
170
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
2026年はチャンキングを極める!
shibuiwilliam
9
1.9k
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.5k
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
440
ClickHouseはどのように大規模データを活用したAIエージェントを全社展開しているのか
mikimatsumoto
0
190
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
Context Engineeringの取り組み
nutslove
0
280
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
180
セキュリティ はじめの一歩
nikinusu
0
1.5k
Featured
See All Featured
Fireside Chat
paigeccino
41
3.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
190
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
160
Building the Perfect Custom Keyboard
takai
2
680
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
320
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Deep Space Network (abreviated)
tonyrice
0
45
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
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