Difference between Concurrency and Parallelism in Go

 

  • Concurrency is when a program can handle multiple tasks at once while parallelism is when a program can execute multiple tasks at once using multiple processors.
  • In other words, concurrency is a property of a program that allows you to have a multiple tasks in progress at the same time, but not necessarily executing at the same time.
  • Parallelism is a runtime property where two or more tasks are executed at the same time.
  • Key tools for concurrency in Golang are goroutines and channels. Goroutines are concurrent lightweight threads while channels allow goroutines to communicate with each other during execution.