liveBook · Manning

Parallelism

As explained in The Coder Cafe

Parallelization is the transformation of a workload so that independent portions can execute concurrently.

Parallelism means executing multiple tasks at the same time by using additional resources. It differs from concurrency: concurrency organizes tasks so they can be handled independently, even when they do not run simultaneously. section 2.1

A busier coffee shop

One waiter and one coffee machine serve customers in sequence. Add a second waiter and machine, and two customers can be served at once: that is parallelism. Instead, assigning one waiter to orders and another to coffee changes how work is organized; that is concurrency, whether or not the tasks run simultaneously. section 2.1.1

Neither term guarantees the other. Multiple requests can run in parallel without each request being divided into independently managed subtasks. Coroutines show the reverse: they can pause and resume tasks within one thread, providing concurrency without parallelism. section 2.1.2 section 2.2

Decide whether parallel execution is worth its cost:

  • Consider it for CPU-bound work such as data processing or graphics rendering, or to improve throughput when handling requests and file operations. section 2.1.2
  • Account for synchronization overhead and memory bottlenecks; lightweight tasks or tasks that coordinate frequently may not benefit. section 2.1.2
  • Benchmark rather than assume linear scaling. In one theoretical i7-7700K example, spreading work across eight available threads yields an estimated 520% efficiency relative to one thread, not 800%. section 8.2.4

How The Coder Cafe covers it

How deep it goes
Defines parallelism through an analogy and use cases, then qualifies expected scaling without giving an implementation procedure.
Examples
Uses two waiters with separate coffee machines, parallel user requests, and an eight-thread CPU scaling estimate.
What it assumes
Introduces the distinction before coroutines or mutexes, using a coffee shop example before implementation details.
What you can do after
Evaluate/understand when simultaneous execution may improve throughput and when overhead or bottlenecks call for benchmarking.
How it connects
Connects parallelism to concurrency, coroutines, multithreading, synchronization, and simultaneous multithreading.

Also explained in

Compare how 55 books explain parallelism →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Coder Cafe. The section links point to the parts of the book it draws on.