Core Java

Java Concurrency Essentials Tutorial

Course Overview

Concurrency is always a challenge for developers and writing concurrent programs can be extremely hard. There is a number of things that could potentially blow up and the complexity of systems rises considerably when concurrency is introduced.

However, the ability to write robust concurrent programs is a great tool in a developer’s belt and can help build sophisticated, enterprise level applications.

In this course, you will dive into the magic of concurrency. You will be introduced to the fundamentals of concurrency and concurrent code and you will learn about concepts like atomicity, synchronization and thread safety.

As you advance, the following lessons will deal with the tools you can leverage, such as the Fork/Join framework, the java.util.concurrent JDK package. To sum those up, you will learn about testing concurrent applications.

About the Author

Martin is a software engineer with more than 10 years of experience in software development.His current interests include Java EE, web applications with focus on HTML5 and performance optimizations. Currently Martin works for an international operating company in the Java EE domain and is concerned in his day-to-day work with larg-scale big data systems.


Introduction to Threads and Concurrency

In the first lesson of our course, you will get introduced to the magical world of Concurrency. You will lean about Threads and how to create them, start them, put them to sleep and more. Additionally, you will get a first look at Synchronization as well as Atomic Access to variables. Sample code is provided for each of the examples.

Concurrency Fundamentals: Deadlocks and Object Monitors

In this lesson, you will learn about important aspects of concurrent applications, such as liveness and multi-threading. You will learn how to avoid common pitfalls of parallel programming, such as deadlocks, thread starvation etc. Additionally, you will get a look into code synchronization and how that can be achieved. Finally, design strategies for writing multi-threaded code will be examined.

The java.util.concurrent Package

In this lesson, we will focus on the java.util.concurrent Package, which includes many interesting classes that provide necessary and helpful functionality needed to implement multi-threaded applications. We will see how to use the relevant API classes, like the executors, the concurrent collections, the atomic variables and more.


Performance, Scalability and Liveness

In this lesson, we discuss the topic of performance for multi-threaded applications. After defining the terms performance and scalability, we take a closer look at Amdahl’s Law. Further in the lesson we see how we can reduce lock contention by applying different techniques, which are demonstrated with code examples.

Fork/Join Framework

In this lesson, we discuss the Fork/Join Framework which is part of the JDK since version 1.7. This framework provides a very handy set of classes that can be used to write concurrent applications based on the relevant algorithm. We will explore the main classes and provide examples on how to use them.

Testing Concurrent Applications

In this final lesson, we will discuss the testing of multi-threaded applications. We implement a simple blocking queue and test its blocking behavior as well as its behavior and performance under stress test conditions. Finally we shed some light on available frameworks for unit testing of multi-threaded classes (e.g. JMock, Grobo Utils, etc).

Make sure to retweet this, let your social followers know!

Martin Mois

Martin is a Java EE enthusiast and works for an international operating company. He is interested in clean code and the software craftsmanship approach. He also strongly believes in automated testing and continuous integration.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newest Most Voted
Inline Feedbacks
View all comments
Tanzeem Akhtar
8 years ago

Thank you Martin Mois for sharing this detailed tutorial.
It’s really helpful. Keep up the good work.

Sainadh Rock star
Sainadh Rock star
8 years ago

Awesome tutorial, I really got the detailed explanation on multi-threading and concurrency concepts.

Thank you so much :)

Kayaman, Hayri Emrah
Kayaman, Hayri Emrah
7 years ago

Precisely written, well knowledged, tutorial, must read for anyone !

Beside : Thank you so much for the given support and friendship in the past during my time on NOMT and MOLS projects

Sincerly, greets

Hayri Emrah Kayaman

7 years ago

Your are a super star , thank you :)

Back to top button