⚙️Concurrency
Also known as Concurrent Programming, Concurrent
Handling many tasks in the same stretch of time by taking turns.
Think of it like
Think of it like one cook making soup and toast. They stir, then butter, then stir again.
Example
Lucy's Node.js server handles 1,000 visitors on one thread. While one request waits for the database, it starts on the next.
Why it matters
Most programs spend their time waiting. With concurrency they can do useful work while they wait.
Definition
Common mistake
Key takeaways
- 1Take turns. Each task moves forward.
- 2Use the waits. Run another task meanwhile.
- 3Not always parallel. One core can do it.