Concurrency can be applied in a variety of ways. Usually, the motivation behind concurrency is to run more than one task simultaneously in order to get work done faster. As we discussed at the beginning of this book, concurrency can also help our code resemble the real world more, where multiple activities occur at the same time.
First, let's cover some fundamental concepts behind concurrency.
One common application of concurrency is to run different tasks simultaneously. Imagine that you have three chores: mow the lawn, trim the trees, and pull the weeds. If you do these three chores by yourself, you can only do one chore at a time. You cannot mow the lawn and trim the trees simultaneously. You have to sequentially mow the lawn first, then trim the trees, and then pull the weeds. But if you have a friend to help you, one of you can mow the lawn...