Slide 7
Slide 7 text
func main() {
// Create goroutines.
for _, i := range images {
go process(i)
}
...
// Wait.
<-ch
}
func process(image) {
// Create goroutine.
go reportMetrics()
complicatedAlgorithm(image)
// Write to file.
f, err := os.OpenFile()
...
}
runs goroutines created
coordinates:
blocking system calls, network I/O,
runtime tasks garbage collection.
pauses and resumes them:
blocking channel operations,
mutex operations.
…for hundreds of thousands of goroutines*
* dependent on workload and hardware, of course.