Chapter 7 Concurrency

THE OCP EXAM TOPICS COVERED IN THIS CHAPTER INCLUDE THE FOLLOWING:

  • ✓  Java Concurrency
    • Create worker threads using Runnable, Callable, and use an ExecutorService to concurrently execute tasks
    • Identify potential threading problems among deadlock, starvation, livelock, and race conditions
    • Use synchronized keyword and java.util.concurrent.atomic package to control the order of thread execution
    • Use java.util.concurrent collections and classes including CyclicBarrier and CopyOnWriteArrayList
    • Use parallel Fork/Join Framework
    • Use parallel Streams including reduction, decomposition, merging processes, pipelines, and performance.

images

As you shall learn in Chapter 8, “IO,” and Chapter 10, “JDBC,” computers are capable of reading and writing data to external resources. Unfortunately, as compared to CPU operations, these disk/network operations tend to be extremely slow. So slow, in fact, that if your computer’s operating system were to stop and wait for every disk or network operation to finish, your computer would appear to freeze or lock up constantly.

Luckily, all modern operating systems support what is known as multi-threaded processing. The idea behind multi-threaded processing is to allow an application or group of applications to execute multiple tasks at the same time. This allows tasks waiting for other resources to give way to other processing requests. ...

Get OCP Oracle® Certified Professional Java® SE 8 Programmer II 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.