Analyzing Memory Risks in Java's newFixedThreadPool and newCachedThreadPool
Memory Saturation in Fixed Thread Pools
When instantiating a thread pool via Executors.newFixedThreadPool(n), the underlying implementation utilizes an unbounded LinkedBlockingQueue. This design creates a specific failure mode where the queue can grow indefinitely if the task production rate outpaces the consumption rate of the fixed number of ...
Posted on Sat, 13 Jun 2026 16:39:10 +0000 by André D
ScheduledExecutorService CPU Spikes to 100% Due to Thread Pool Bug
When using ScheduledExecutorService with a core pool size of 0, a JDK bug can cause CPU usage to spike to 100%. This occurs due to an infinite loop in the getTask method of ThreadPoolExecutor when keepAliveTime is set to 0 nanoseconds.
Problem Demonstration
public static void main(String[] args) {
ScheduledExecutorService executor = Executo ...
Posted on Thu, 04 Jun 2026 19:18:20 +0000 by skhale
Concurrency in Python: Threading and Multiprocessing
The concurrent module in Python facilitates concurrent programming, particularly for task scheduling and managing thread/process pools. Its core component is concurrent.futures, which offers high-level interfaces for handling threads and processes.
Key Methods
submit(fn, *args, **kwargs): Asynchronously submits a task and returns a Future obje ...
Posted on Sun, 17 May 2026 21:35:19 +0000 by allinurl
Understanding .NET Threading Timer Internals and Usage Patterns
Introduction to ThreadingTimer
System.Threading.Timer represents a lightweight, thread-pool-based timing mechanism in .NET. Instead of maintaining a dedicated thread, it leverages OS-level timer services to queue callbacks to the thread pool when scheduled intervals elapse.
Core Timer Characteristics
// Complete Timer constructor signature
publ ...
Posted on Sat, 16 May 2026 05:30:58 +0000 by stephenalistoun
Understanding Java Lock Mechanisms and Thread Communication
Lock Types in Java Concurrency
Fair vs Unfair Locks
Fair locks ensure threads acquire locks in the order they requested them, preventing thread starvation but potentially reducing throughput. Unfair locks allow threads to acquire locks out of order, which can improve performance but may lead to some threads waiting indefinitely.
// Creating a f ...
Posted on Tue, 12 May 2026 15:06:11 +0000 by jgires