Updated at 2018-06-22 02:05

Concurrency and parallelism are related but different concepts. Concurrent solutions may or may not be parallelizable.

  • Concurrency is about __dealing with __ lots of things at once.
  • Parallelism is about doing lots of things at once.

Real parallelism requires multiple CPU cores. Modern laptops have 4 cores but run more than 100 processes at any given time. Thus, most processing happens concurrently and not in parallel. The computer is making sure every process has a chance to make progress.

Concurrency is hard. It can create hard to debug errors and unstable software states, but on the same time concurrent design improves code structure and may improve performance.

Object-oriented programming handles concurrency wrong most of the time. Most used locking of execution that is complex and not very efficient.

Pure functional programming languages work better with concurrency. Functions cannot have side effects thus two different functions can always be ran in parallel. Processes are created by chaining functions.

Whatever you use to develop concurrent system, keep concurrent code totally separate from non-concurrent code. Also limit write access to data that is shared by these two.