Course in Threads and Concurrency in Java

Course in designing multi-threaded and concurrent applications in Java

In this course you will learn everything you need to know (and a little bit more) about concurrency and multi-threaded applications in Java. You will learn about the classical thread support in Java, as well as the executors framework and fork-join concurrency. In addition, you will learn about classical concurrency problems such as critical sections, race conditions and deadlocks. You wil also learn how to implement message passing between threads, using fututes and much more.
This is what you will learn
  • Understand classical concurrency problems such as critical sections, race conditions and deadlocks
  • Know how to design a multi-threaded program using message passing
  • Know to utilize thread pools
  • Know how to design fork-join concurency based programs
Course Contents

Overview of Concurrency

    Threads in Java

    • Usage of class Thread
    • Usage of interface Runnable
    • Life-cycle methods
    • How to interrupt, but not stop, a thread

    Critical Sections

    • The Bank problem
    • What is a critical section
    • What is a mutex lock
    • Riboe's conditions for critical sections
    • Using synchronized blocks and methods in Java

    Race Conditions

    • The MailBox problem
    • What is condition/event synchronization
    • The minimal amount of code to safely send a message from one thread to another
    • Using wait and notify
    • Understanding the difference between notify and notifyAll
    • A few words about monitor semantics
    • Possible livelock with careless usage of notify


    • What is a resource
    • Starvation
    • What is a deadlock
    • Coffman's conditions for deadlocks
    • Preventing deadlocks
    • Dealing with deadlocks
    • How the JVM detect deadlocks

    Uni-Directional Message-Passing

    • Design of a blocking message queue
    • Thread safe queues in the Java API
    • Design and implementation of MessageQueue and MessageThread

    Bi-Directional Message-Passing

    • What is rendezvous
    • Implementation of rendezvous
    • What is a future and how can it be used
    • Realizing N --> 1 and 1 --> N communication patterns

    Thread Pools

    • The Executors framework
    • Callable and Executor
    • ExecutorService
    • Adapting the pool size to the number of processing units
    • Typical tasks for thread pools


    • What is fork-join concurrency
    • Designing a fork-join task
    • Using a fork-join pool and schedule many tasks
    • Typical tasks for fork-join pools

    Atomic Data-Types

    • What is an atomic type
    • AtomicInteger and friends

    Lock and Synchronization Classes

    • How to use read-write locks
    • How to use dedicated lock and synchronization objects
    • Barriers, latches, phasers and other fun synchronizators
    • Semaphores
    • Optimistic locks
    Name Threads and Concurrency in Java
    Duration2 Days
    Audience Java programmers
    PrerequisitesPractical knowledge in Java programming
    • Java JDK, version 10+
    • JetBrains IntelliJ IDEA
    Course Dates
    2020-02-20Stockholm15 000 kr
    2020-03-12Stockholm 15 000 kr
    2020-04-02 Stockholm15 000 kr
    2020-04-27Stockholm15 000 kr
    2020-05-18Stockholm15 000 kr

    Same-Company Discout

    We offer a 20% discount for additional participants from the same company and at the same course date. Read more here.

    Teaching Language

    Our printed course material is always authored in English. The oral presentation in our classrooms is generally in Swedish, unless all participants agree to that we perform the course in English.

    On-Site Course

    If you order an On-Site course, we will come to you and hold the course in your office. The price is determined by our price model and is based on the number of course days, number of participants and any travel and lodging.

    Read more about out price modell and term of sales here.

    Related Courses
    CourseDays Level
    Java Basics5BeginnerShow
    Java Intermediate3IntermediateShow
    Java for REST Web Services Apps3 IntermediateShow