Introduction
There is software that’s meant to be used by a single user, and most of what you’ve learned so far in this book allows you to develop such applications. There is other software, however, that is meant to be used by several users at the same time. An example of this is a web server. You created web servers in Chapter 16, Web Servers. They are designed to serve websites or web applications that are generally used by thousands of users at the same time.
When multiple users are accessing a web server, it sometimes needs to perform a series of actions that are totally independent and whose result is the only thing that matters to the final output. All these situations call for a type of programming in which different tasks can be executed at the same time, independently from each other. Some languages allow parallel computation, where tasks are computed simultaneously.
In concurrent programming, when a task starts, all other tasks start as well, but instead...