Day 29

1 min readMay 21, 2021


Piña coladas in parallel.

As beginners, we’re taught that programming is sequential.
Do this, then do that, and do this if that.

But for larger projects, the milliseconds it takes to execute an instruction quickly add up when you have hundreds, or even thousands, of lines of code.

This is where concurrency comes into use: running separate parts of the program at the same time to make the overall time faster.

A busy bartender serving multiple piña coladas would take much longer making them one by one, than by splitting the tasks up where possible and performing them concurrently:

“The ideal things to split this way are pieces of work that are relatively independent — where each can proceed without waiting for anything from the others. A common pattern is to take a large piece of work, split it into independent chunks, process each in parallel, then combine the results.”

Running things in parallel isn’t always better or faster than running them sequentially, but if the opportunity arises, why not take it?

Thank you for reading!