</> MAANG.io
coding interview · 101

Foundations

Master coding interviews with comprehensive coverage of data structures, algorithms, and problem-solving techniques. Progress from fundamentals to advanced topics with expertly curated content.

0/255 solved 0% complete

Concurrency and Multithreading

Core idea: Concurrency means multiple threads make progress over the same time window — often interleaving on the same CPU. The instant they share data, the order of their individual steps is no longer guaranteed, and "obviously correct" code can produce impossible results. The whole discipline is coordinating access to shared state so every interleaving is still correct.


Concurrent ≠ parallel

  • Concurrent — multiple tasks in progress over the same period; they may interleave on one core (the scheduler switches between them).
  • Parallel — tasks literally running at the same instant on different cores.

You write concurrency code (locks, conditions) to be correct under either. The hard part isn't speed — it's that the scheduler can pause a thread between any two statements.


Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.