Bitpath

Lesson 1 · Unit 01

Concurrent is not parallel

One cook, two dishes: overlap the waiting

12 exercisesabout 3 min

What you practise

  • Interleaving one cook's tasks vs two cooks, I/O-bound vs CPU-bound work, threads, processes and async at a glance, where the speedup comes from

Try a question from this lesson

Pick one

One cook makes toast (2 minutes in the toaster) and a boiled egg (5 minutes in the pot). Each needs only seconds of hands-on work. How long until both are ready?

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Concurrent or parallel

Concurrent: several tasks are in progress at once. One worker can do it by switching between them.

Parallel: several workers run at the same instant. That needs more than one core.

Concurrency is a way to organise work. Parallelism is extra hands.

one worker, switching:
  worker    A1 B1 A2 B2 A3 B3

two workers, in parallel:
  worker 1  A1 A2 A3
  worker 2  B1 B2 B3

Concept

Waiting or computing

I/O-bound work is mostly waiting: a reply from a server, a file from a disk, a row from a database, a timer. While it waits, the CPU is free.

CPU-bound work is mostly computing: resizing images, hashing, parsing, simulating. The CPU is busy the whole time.

Waits can overlap on one thread. Computing cannot: it needs more cores.

9 more exercises in the app

  • 3× multiple choice
  • 3× type the answer
  • 1× true or false
  • 1× fill the blanks
  • 1× match the pairs

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy