Java Multi-threaded Circular Printing
This article demonstrates several approaches to implement circular printing among multiple threads in Java. The goal is to have three threads print their respective numbeers (0, 1, 2) in order, cycling through 10 times.
1. Flag Variable + Mutex Lock
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public ...
Posted on Fri, 05 Jun 2026 17:01:46 +0000 by MikeyNoedel
Kotlin Coroutines Context and Dispatchers
Every coroutine executes within a context represented by CoroutineContext, which is part of the Kotlin standard library. This context is a collection of elements, with the most important being the coroutine's Job and its dispatcher.
Dispatchers and Threads
The coroutine context includes a coroutine dispatcher that determines what threads the co ...
Posted on Thu, 04 Jun 2026 17:52:59 +0000 by gregolson
Understanding Go Concurrency Primitives: sync, Cond, Atomic, and Context
Introduction
This article explores key concurrency primitives in Go, including synchronization mechanisms, condition variables, atomic operations, and the context package. We'll examine how these tools help manage concurrent operations and shared resources in Go programs.
Synchronization with the sync Package
The sync package provides fundament ...
Posted on Wed, 03 Jun 2026 18:18:59 +0000 by Jorge
Enhancing Django Application Concurrency with uWSGI and Nginx
The default Django development server operates on a single thread, handling requests sequentially. This means a second request must wait for the first to complete before processing begins, leading to blocking behavior unsuitable for production workloads.
To achieve high concurrency, a common approach involves deploying Django with uWSGI as the ...
Posted on Tue, 02 Jun 2026 16:37:47 +0000 by LostKID
Managing Cancellation and Deadlines in Go Concurrent Workflows
In Go, the context package is essential for controlling the lifetime of processes. It carries deadlines, cancellation signals, and request-scoped values across API boundaries. When handling concurrent operations, particularly those involving I/O, it is critical to respect these constraints to prevent resource leaks and ensure system responsiven ...
Posted on Mon, 01 Jun 2026 17:52:15 +0000 by McChicken
Understanding the Implementation Principles of Java's Synchronized Mechanism
Understanding the Internal Implementation of synchronized (Deep Dive with Monitor)
Core Premise: Locks are Bound to Objects
The synchronized keyword in Java, whether applied to methods or code blocks, ultimately associates with a specific object. Instance methods bind to the current object instance (this), static methods bind to the Class obj ...
Posted on Mon, 01 Jun 2026 17:30:19 +0000 by hws
Fundamentals of Concurrent Programming
Root Causes of Concurrency Issues
Visibility
Visibility refers to the ability of a thread to immediately observe changes made to shared variables by other threads. The fundamental problem stems from CPU cache architectures.
// Thread A executes
int counter = 0;
counter = 42;
// Thread B executes
int result = counter;
When Thread A executes c ...
Posted on Sun, 31 May 2026 23:21:42 +0000 by fris
Deep Dive into Java's `Collections` Utility Class
The java.util.Collections class is a fundamental utility within the Java platform, providing a suite of static methods designed to perform various operations on collection objects. Described as offering "polymorphic algorithms," this class simplifies common tasks such as sorting, searching, modifying, and creating specialized versions ...
Posted on Sat, 30 May 2026 21:05:45 +0000 by danmon
Implementing High-Performance Queues with Disruptor
Disruptor is a high-performence inter-thread messaging library developed by LMAX. It's widely used in projects like Log4j2 and Storm for its exceptional throughput characteristics.
Ring Buffer Architecture
Disruptor employs a ring buffer structure with several performence advantages:
Array-based storage: Uses fixed-size arrays instead of linke ...
Posted on Sat, 30 May 2026 19:12:15 +0000 by dustinnoe
Advanced C# Threading: Task Management, Async Programming, and Concurrency Patterns
Process, Thread, and Multi-threading Concepts
A process represents all computing resources consumed by a running program. A thread is the smallest unit of program execution flow, dependent on processes, where one process can contain multiple threads.
Multi-threading involves multiple execution flows running simultaneously:
CPU operations utili ...
Posted on Fri, 29 May 2026 17:53:01 +0000 by MichaelHe