Until now, we have been exclusively concerned with sequential programs that execute a single stream of operations. Even the GUI programming in the previous section avoided concurrent execution by terminating the controller as soon as it finished setting up the model and view.
Concurrent computation makes programming much more complex.
In this section, we will explore the extra problems posed by concurrency and outline some strategies for managing them. In a concurrent program, several streams of operations may execute concurrently. Each stream of operations executes as it would in a sequential program except for the fact that streams can communicate and interfere with one another . Each such sequence of instructions is called a thread . For this reason, sequential programs are often called single-threaded programs.