The Power of Concurrency

We’re interested in concurrency for two reasons: to make an application responsive/improve the user experience and to make it faster.

Making Apps More Responsive

When we start an application, the main thread of execution often takes on multiple responsibilities sequentially, depending on the actions we ask it to perform: receive input from a user, read from a file, perform some calculations, access a web service, update a database, display a response to the user, and so on. If each of these operations takes only fractions of a second, then there may be no real need to introduce additional flows of execution; a single thread may be quite adequate to meet the needs.

In most nontrivial applications, however, these operations ...

Get Programming Concurrency on the JVM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.