Why I love Go: ConcurrencyDevMemphis - Dec 2024 - Bryce SharpWhy I love Go: ConcurrencyDevMemphis - Dec 2024 - Bryce SharpWhy I love Go: ConcurrencyDevMemphis - Dec 2024 - Bryce SharpWhy I love Go: ConcurrencyDevMemphis - Dec 2024 - Bryce SharpWhat's in the talk?> Concurrency & Parallelism> High Level Hardware Concepts> Real World Problems> Go Basics> Go Concurrency> Goroutines> Channels> Live Demo> Q&A Concurrency & ParallelismThey are not the same thing.Concurrency: handling multiple processes on a single cpuParallelism: running at least one process on multiple cpus at the same timeConcurrency & ParallelismOne Gopher Concurrently 3 Gophers Juggling 3 Balls Juggling 3 Balls In ParallelConcurrency & ParallelismGophers = CPUsBalls = ProcessesHigh Level Hardware ConceptsCentral Processing UnitWorks with binary streams to do thebinary math that enable modern computingModern day CPUs tend to possess multiple coresHigh Level Hardware ConceptsCPUMemoryKernelAppsCPUHigh Level Hardware ConceptsHigh Level Hardware ConceptsMemoryRandom Access Memory (RAM) and Disc Drivesare the most knownHolds physical representation of our applicationlayer dataCPUMemoryCPU001010010110100 High Level Hardware ConceptsCPU10100 MemoryReal World Problems#1: Sending multiple http requests at the same time#2: Throttling SQL queries in batch processingHigh Level Hardware ConceptsHigh Level Hardware ConceptsGo BasicsDesigned at Google in 2007 and open sourced in 2009Efficiency & Usability FocusedStatically TypedGo ConcurrencyGoroutine: "a lightweight thread managed by the Go runtime"Channel: "a typed conduit through which you can send and receive values with the channel operator, <-" - Tour of GoGo Concurrency" Do not communicate by sharing memory; instead, share memory by communicating"GoroutineChannelsGo ConcurrencyGoroutines are not thread safe. Communicating exclusively through channels solves this problem. There is a mutex on the channel thatserves as synchronization across goroutinesGo ConcurrencyGo uses an M:N scheduler to make goroutines "user-space threads"Live Demo Q&AThank you for listening!OS Thread 1OS Thread 2go 1go 3go 2go 3go 2go 1go 2Gopackage main import "fmt" func main() { fmt.Println("Hello");}Chapter 1Gopackage main import "fmt" func main() { fmt.Println("Hello");}Chapter 1Gopackage main import "fmt" func main() { fmt.Println("Hello");}Chapter 1Gopackage main import "fmt" func main() { fmt.Println("Hello");}Chapter 1Special Thanks To> Free Gopher Graphics: https://github.com/egonelbre/gophers> Free Gopher Graphics: https://github.com/MariaLetta/free-gophers-pack> Background img: https://pixabay.com/vectors/cartoon-pink-tree-landscape-field-7106965/> GopherCon 2017 - Kavya Joshi https://www.youtube.com/watch?v=KBZlN0izeiY> A Tour of Go: https://go.dev/tour> Go Docs: https://pkg.go.dev/stdGopackage main import "fmt" func main() { fmt.Println("Hello");}Chapter 1Gopackage main import "fmt" func main() { fmt.Println("Hello");}Chapter 1Live Demo
1
  1. New frame
  2. New frame
  3. New frame
  4. New frame
  5. New frame
  6. New frame
  7. New frame
  8. New frame
  9. New frame
  10. New frame
  11. New frame
  12. New frame
  13. New frame
  14. New frame
  15. New frame
  16. New frame
  17. New frame
  18. New frame
  19. New frame
  20. New frame
  21. New frame
  22. New frame
  23. New frame
  24. New frame
  25. New frame