difference between parallelism and concurrency

tags: learning parallelism programming concurrency diff-between

content

concurrency:

  • different tasks execute independently, they might communicate with each other
  • dealing with a lot of things at once
  • having different components in a program parallelism:
  • different tasks execute at the same time, simultaneously
  • doing a lot of things at once

concurrency

  • breaking down a problem to different steps (independent components)
  • and assign go routines to do the steps (compose the independent components to solve the problem)
  • maybe think of the design as doing things in a requester-worker model, instead of multiple of same workers doing the same things at the same time

Concurrency is concerned with nondeterministic composition of programs (or their components).
Parallelism is concerned with asymptotic efficiency of programs with deterministic behavior.
… Concurrency is all about managing the unmanageable: events arrive for reasons beyond our control, and we must respond to them. A user clicks a mouse, the window manager must respond, even though the display is demanding attention. Such situations are inherently nondeterministic, but we also employ pro forma nondeterminism in a deterministic setting by pretending that components signal events in an arbitrary order, and that we must respond to them as they arise. .. Parallelism Is Not Concurrency | Existential Type

it’s about writing code so that the outcome is always the same regardless whether it’s run sequentially or in parallel Golang UK Conference 2017 | Arne Claus - Concurrency Patterns in Go

concurrent program is one with multiple threads of control.  Each thread of control has effects on the world, and those threads are interleaved in some arbitrary way by the scheduler.  We say that a concurrent programming language is non-deterministic, because the total effect of the program may depend on the particular interleaving at runtime. … we can run concurrent programs in parallel without changing their semantics. However, concurrent programs are often not compute-bound, so there’s not a great deal to be gained by actually running them in parallel Parallelism /= Concurrency | GHC Mutterings

up

down

reference