Understanding Async/Await and Task in C#
In C# asynchronous programming, the Task class provides a more efficient alternative to traditional Thread operations. Tasks utilize the thread pool, which reuses threads to reduce the overhead of creating and destorying threads frequently.
When comparing Thread and Task execution, you can observe the difference in thread usage patterns:
class ...
Posted on Fri, 18 Sep 2026 16:34:10 +0000 by iamngk
Fundamentals of Concurrent Programming in Java
Process vs Thread
A process represents an executing instance of a program and forms the basic unit of execution managed by the operating system. It encompasses creation, execution, and termination phases. A thread, smaller than a process, operates within a process. Multiple threads can run concurrently inside one process and share its heap and ...
Posted on Tue, 15 Sep 2026 16:25:34 +0000 by ruben-
Avoiding Deadlocks When Using Thread Pools with Parent-Child Tasks
When working with thread pools, a common pitfall arises when parent and child tasks share the same pool. This can lead to unexpected deadlocks and incorrect execution timing.
Consider a simple example where a thread pool handles five independent tasks via a loop. Each task processes data asynchronously and uses a CountDownLatch to signal comple ...
Posted on Sun, 30 Aug 2026 16:41:36 +0000 by czs
Understanding Thread Pool: Why Idle Non-Core Threads Are Not Immediately Recycled
Recently, a friend asked me a question on WeChat. He said: "WhyBro, are you there?"
I replied: "What's up?"
He quickly threw out a question.
I took a casual glance and thought this question was very simple.
But it turned out there was a hidden article behind it.
The story starts with this question:
The thread pool configura ...
Posted on Fri, 21 Aug 2026 16:02:44 +0000 by sciencebear
Java Thread Pool Implementation: Parameters, Factory Methods, and Execution Flow
Thread Pool Mechanism
Creating and destroying threads repeatedly introduces significant overhead when handling a large volume of concurrent tasks. A thread pool maintains a pool of reusable worker threads, eliminating the need to spawn new threads for each task. When a task arrives, its assigned to an idle thread from the pool. After completing ...
Posted on Thu, 30 Jul 2026 17:04:22 +0000 by Tory
Understanding BlockingQueue in Java: Internal Principles and Use Cases
Understanding BlockingQueue in Java: Internal Principles and Use Cases
BlockingQueue is a core component of Java concurrent programming. It serves both as a "queue" (storing elements) and provides "blocking" characteristics: a thread fetching an element blocks when the queue is empty, and a thread inserting an element blocks ...
Posted on Mon, 27 Jul 2026 17:14:29 +0000 by gfrank
Understanding ThreadPoolExecutor, Executors Factory Class, and Optimal Thread Pool Sizing in Java
Introduction to Thread Pools
Thread Pool: A thread management technology based on the concept of pooling, designed to reuse threads, conveniently manage threads and tasks, and decouple thread creation from task execution. In Java, thread pools are primarily created using the ThreadPoolExecutor class, and the JDK also provides the Executors fact ...
Posted on Tue, 14 Jul 2026 16:16:55 +0000 by php3ch0
Designing and Implementing Custom Thread Pools in Java
Java supports multithreading natively. Common ways to create threads include extending Thread, implementing Runnable, or using Callable with FutureTask. These approaches lack centralized lifecycle control, which motivates the use of managed thread pools.
Thread Lifecycle Control via Volatile Flags
A background thread can be stopped gracefully u ...
Posted on Sat, 11 Jul 2026 16:35:37 +0000 by mikeyinsane
Thread Pool Deadlock Caused by Parent-Child Task Dependencies
The Concurrency PitfallConsider a scenario where a fixed-size thread pool is used to process multiple primary operations. Each primary operation retrieves a collection of records and processes them sequentially. To optimize throughput, the processing of individual records is offloaded to the same thread pool as asynchronous sub-tasks, while the ...
Posted on Mon, 29 Jun 2026 17:14:09 +0000 by Yola
Java Multithreading: Complete Implementation Guide with Examples
Java provides several mechanisms for creating and managing multithreaded applications. This guide covers all official approaches, from basic to advanced, with practical examples and comparison.
Overview of Implementation Methods
Java defines two fundamental approaches for multithreaded programming, though real-world applications typically use o ...
Posted on Thu, 18 Jun 2026 18:01:36 +0000 by cirko