One of our reader, Anant, asked this extremely good question to elaborate / list down all related topics that we should know about multi-threading including changes made in java 8.( Beginner level to Advance level). All he wanted to know was evolution of Multi-threading Framework in Java from Simple Runnable
interface to latest feature in Java 8. Let us solve his query.
I spent good amount of time in collecting all below information. So please feel free to suggest edit/update in below information if you think otherwise on any point.
JDK release-wise multi-threading concepts
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
java.lang.ThreadDeath
- and some exception classes
e.g.
java.lang.IllegalMonitorStateException
java.lang.IllegalStateException
java.lang.IllegalThreadStateException
.
It also had few synchronized collections e.g. java.util.Hashtable
.
JDK 1.2 and JDK 1.3 had no noticeable changes related to multi-threading. (Correct me if I have missed anything).
JDK 1.4, there were few JVM level changes to suspend/resume multiple threads with single call. But no major API changes were present.
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. The biggest change in java multi-threading applications cloud happened in this release.
Read full set of changes in this link: http://docs.oracle.com/javase/1.5.0/docs/guide/concurrency/overview.html
JDK 1.6 was more of platform fixes than API upgrades. So new change was present in JDK 1.6.
JDK 1.7 added support for ForkJoinPool
which implemented work-stealing technique to maximize the throughput. Also Phaser
class was added.
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
.
The Collections Framework has undergone a major revision in Java 8 to add aggregate operations based on the newly added streams facility and lambda expressions; resulting in large number of methods added in almost all Collection
classes, and thus in concurrent collections as well.
Read full set of changes in this link: http://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/changes8.html
References:
- https://www.cs.princeton.edu/courses/archive/fall97/cs461/jdkdocs/relnotes/intro.html
- http://programmers.stackexchange.com/questions/147205/what-were-the-core-api-packages-of-java-1-0
- http://docs.oracle.com/javase/1.5.0/docs/guide/concurrency/overview.html
- http://docs.oracle.com/javase/7/docs/technotes/guides/concurrency/changes7.html
- http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html
- http://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/changes8.html
I hope that above listings will help you understanding the multi-threading features JDK version wise.
Happy Learning !!
Comments