GLAST
A comparison between concurrency and parallelism in Golang
By
Martin Elias Quintero Osorio
Manuela Castrillón Medina
the original idea...
BLAST
the original idea...
BLAST
BLAST
BLAST
BLAST
BLAST
concurrency vs. parallelism
GOLANG
Programming language created at Google
- Golang is open-source but backed up by a large corporation
- Many big companies used it for their projects (Google, Dropbox, Soundcloud, Docker, Cloudflare, BBC...)
- It’s fast (to learn, to develop in, to compile, to deploy, to run)
- Go is a modern language
- Golang is simple
- Good cross-platform support
- Go is safe
- Rapid development and growing community
- It’s concurrent
GOROUTINES
Lightweight thread of execution.
package main
import (
"fmt"
"time"
)
func say(s string) {
for i := 0; i < 5; i++ {
time.Sleep(100 * time.Millisecond)
fmt.Println(s)
}
}
func main() {
go say("world")
say("hello")
}
/*
world
hello
hello
world
world
hello
hello
world
world
hello
*/
GOMAXPROCS
Limits the number of operating system threads that can execute user-level Go code simultaneously
func GOMAXPROCS(n int) int
Glast
We will count the lines quantity in a large file using a basic master - worker model in Golang in four different ways:
- Linear
- Using goroutines (concurrency)
- Using GOMAXPROCS (parallelism)
- Using goroutines & GOMAXPROCS
Glast - results
Glast - results
Glast - conclusions
More info...
https://github.com/ManuCastrillonM/glast
ThANK YOU!
Questions?
GLAST
By Manu Castrillón
GLAST
- 934