CyclicBarrier in Java 1. Introduction CyclicBarriers are synchronization constructs that were introduced with Java 5 as a part of the java.util.concurrent package. In this article, we’ll explore this implementation in a concurrency scenario. 2. Java Concurrency – Synchronizers The java.util.concurrent package contains several classes that help manage a set of… Continue Reading java-cyclic-barrier

Java CyclicBarrier vs CountDownLatch 1. Introduction In this tutorial, we’ll compare CyclicBarrier and CountDownLatch and try to understand the similarities and differences between the two. 2. What Are These? When it comes to concurrency, it can be challenging to conceptualize what each is intended to accomplish. First and foremost, both CountDownLatch and CyclicBarrier… Continue Reading java-cyclicbarrier-countdownlatch

The Dining Philosophers Problem in Java 1. Introduction The Dining Philosophers problem is one of the classic problems used to describe synchronization issues in a multi-threaded environment and illustrate techniques for solving them. Dijkstra first formulated this problem and presented it regarding computers accessing tape drive peripherals. The present formulation… Continue Reading java-dining-philoshophers

ExecutorService – Waiting for Threads to Finish 1. Overview The ExecutorService framework makes it easy to process tasks in multiple threads. We’re going to exemplify some scenarios in which we wait for threads to finish their execution. Also, we’ll show how to gracefully shutdown an ExecutorService and wait for already… Continue Reading java-executor-wait-for-threads