November 2016: Concurrency and GOPL
Meetup #34. Please RSVP at Meetup.
We get started at 6:30 pm.
Sponsors
Venue provided by Startup Edmonton.
Food sponsored by Bellstone Engineering.
Talks
Reasons to read The Go Programming Language
Jordan Torbiak (slides)
The Go Programming Language provides great value as a reference in general and in particular for testing and reflection, as a collection of interesting exercises in a reasonable order, and as a comprehensive textbook after more introductory material like the Tour and Effective Go.
Coding for Concurrency: Processes, Threads, and Goroutines
Nicholas Boers contrasted processes, threads, and goroutines to explain why Go's concurrency model is so much cheaper. He opened with the distinction between concurrency (dealing with many things at once) and parallelism (doing many things at once), and traced the ideas back to Dijkstra, Hoare, and Brinch Hansen. The middle of the talk dug into the operating system: processes and fork, IPC mechanisms (pipes, shared memory, signals, semaphores, sockets), then threads and the POSIX threads API — each with its own overheads, from kernel data structures and virtual address spaces to register saves and cache invalidation. He then described the Linux CFS scheduler and how Go sidelines it with its own runtime scheduler built on M (OS thread), P (processor), and G (goroutine), including system-call handoff and work stealing. He finished with GOMAXPROCS (default 1 through Go 1.4, CPU count from 1.5), a busy-loop example, and the takeaway that goroutines carry far less overhead than threads or processes.
Key points:
- Concurrency is composition; parallelism is simultaneous execution.
- Processes and threads both carry significant scheduling and IPC overhead.
- Go programs use several OS threads under the hood.
- The Go runtime, not the OS, schedules goroutines.
- The scheduler uses M (thread), P (processor), and G (goroutine) with work stealing.
GOMAXPROCSlimits threads running Go code (CPU count by default since 1.5).- Goroutines are the lightweight option for concurrency in Go.
News
- Go 1.7.4 coming on December 1st
- 7 years of Go and ~3 years of Edmonton Go
- The Go font family
- Go 1.8 draft release notes
- What is new in database/sql?
- Dependency Management Tool draft spec
- Codebase Refactoring (with help from Go)
Events
- Monthly Hack Day - Dec 3
- Edmonton Go Meetup - January