Java Concurrency 1 - History

date
Feb 12, 2022
slug
java-concurrency-history
status
Published
tags
java
concurrency
coding
programming
summary
Evolving Java support for expressing concurrency
type
Post

Evolving Java support for expressing concurrency

As per JDK 1.x release, there were only few classes present in this initial release. To be very specific, there classes/interfaces were:
  • java.lang.Thread
  • java.lang.ThreadGroup
  • java.lang.Runnable
  • java.lang.Process
JDK 1.5
was first big release after JDK 1.x; and it had included multiple concurrency utilities. Executor, semaphore, mutex, barrier, latches, concurrent collections and blocking queues; all were included in this release itself. In 2004, Java 5 introduced the java.util.concurrent package, which supported more expressive concurrency, particularly the ExecutorService interface (which decoupled task submission from thread execution), as well as Callable<T> and Future<T>, which produced higher-level and result-returning variants of Runnable and Thread and used generics (also introduced in Java 5). ExecutorServices can execute both Runnables and Callables. These features facilitated parallel programming on the multicore CPUs that started to appear the following year.
 
JDK 1.7
added support for ForkJoinPool which implemented work-stealing technique to maximize the throughput. Also Phaser class was added. Java 7 added java.util.concurrent.RecursiveTask to support fork/join implementation of divide-and-conquer algorithms.
JDK 1.8
is largely known for Lambda changes, but it also had few concurrency changes as well. Two new interfaces and four new classes were added in java.util.concurrent package e.g. CompletableFuture and CompletionException. Java 8 added support for Streams and their parallel processing (building on the newly added support for lambdas).
JDK .1.9
provides support for it via the publish-subscribe protocol (specified by the java.util.concurrent.Flow interface). A key concept of CompletableFuture and java.util.concurrent.Flow is to provide programming structures that enable independent tasks to execute concurrently wherever possible and in a way that easily exploits as much as possible of the parallelism provided by multicore or multiple machines. The class java.util.concurrent.Flow provides interfaces that support the Reactive Streams publish-subscribe framework. These interfaces support interoperability across a number of asynchronous systems running on JVMs.
 

© Caner Ertano 2022 - 2024