Does async/await create new threads?
The short answer: NO, not automatically
This is one of the most common misconceptions in C# - async/await on its own doesn't create a new thread. It is a fundamental misunderstanding, worth explaining carefully, because it touches the very heart of the asynchrony model in .NET.
What actually happens - I/O-bound vs CPU-bound
This distinction is key to understanding the whole topic:
I/O-bound (input/output operations) - NO new thread
public async Task<Order> GetOrderAsync(int id)
{
var response = await _httpClient.GetAsync($"api/orders/{id}"); // I/O-bound - operacja SIECIOWA
return await response.Content.ReadFromJsonAsync<Order>();
}
When you call HttpClient.GetAsync(), .NET doesn't block any thread while waiting for the network response. Instead it uses I/O Completion Ports (an operating system mechanism) - the thread returns to the thread pool and is free to handle other work while the network card/operating system asynchronously waits for the response. When the response arrives, the operating system notifies .NET, and the runtime takes a thread from the pool (which may be a different thread from the one that started the operation!) to run the continuation (ReadFromJsonAsync and onwards).
The key takeaway: during the whole time of waiting for the network response, no thread is occupied - this is exactly why async I/O is so efficient in a Web API under heavy load: 1000 concurrent requests waiting for a database don't block 1000 threads, but can be served by e.g. 10 threads that "hop off" to other work when there is nothing to do.
CPU-bound (computationally intensive operations) - Task.Run actually OFFLOADS work to another thread
public async Task<decimal> CalculateComplexDiscountAsync(Order order)
{
// THIS is CPU-bound - heavy computation, not I/O
return await Task.Run(() => PerformExpensiveCalculation(order));
}
private decimal PerformExpensiveCalculation(Order order)
{
// e.g. a complicated simulation, searching a large dataset in memory
decimal result = 0;
for (int i = 0; i < 10_000_000; i++) { result += Math.Sqrt(i); }
return result;
}
Task.Run() actually offloads the execution of a delegate to a thread from the ThreadPool - this is the only scenario in which you can say that "something creates a new worker thread" (or rather: it borrows a thread from the pool, it doesn't create one from scratch on every call, because the ThreadPool manages the pool and reuses threads).
An important distinction: it is Task.Run() that causes a thread from the pool to be used, not async/await itself. await is just a mechanism for waiting for a Task to complete (I/O-bound or CPU-bound) without blocking the calling thread.
A mental diagram - what happens "under the hood"
I/O-bound (HttpClient, EF Core, File I/O):
[Thread A] → calls an I/O operation → GIVES UP the thread to the pool (NO thread occupied while waiting)
→ the operating system/hardware does the work
[Thread B, possibly different from A] ← taken from the pool when the I/O completes → continuation of the method
CPU-bound (Task.Run):
[Thread A] → Task.Run() → OCCUPIES a thread FROM THE POOL for the duration of the computation (the thread is ACTUALLY busy)
[Thread B from the ThreadPool] → performs the computation → returns the result
[Thread A] → resumes execution after the await, when the computation finishes
Why this distinction matters in practice - an anti-pattern
// ❌ ANTI-PATTERN - wrapping I/O-bound work in Task.Run is a waste of resources
public async Task<Order> GetOrderBadAsync(int id)
{
return await Task.Run(async () => // ❌ UNNECESSARY - HttpClient.GetAsync is ALREADY async I/O
{
var response = await _httpClient.GetAsync($"api/orders/{id}");
return await response.Content.ReadFromJsonAsync<Order>();
});
}
// ✅ Correct - I/O-bound WITHOUT Task.Run, because HttpClient ALREADY handles this asynchronously
public async Task<Order> GetOrderAsync(int id)
{
var response = await _httpClient.GetAsync($"api/orders/{id}");
return await response.Content.ReadFromJsonAsync<Order>();
}
Task.Run() on an I/O-bound operation needlessly occupies a thread from the pool for a time when in reality it wouldn't need to be occupied at all - this is a real performance problem in a Web API under heavy load, because you waste threads that could be serving other requests.
Where Task.Run actually makes sense
// In a UI context (WPF) - so as NOT to block the UI thread with heavy CPU-bound computation
private async void CalculateButton_Click(object sender, RoutedEventArgs e)
{
IsCalculating = true;
var result = await Task.Run(() => PerformExpensiveCalculation(data)); // ✅ SENSOWNE - CPU-bound, UI thread wolny
ResultText = result.ToString();
IsCalculating = false;
}
This refers directly to the discussion of SynchronizationContext/the Dispatcher in WPF - Task.Run is the right tool when you want to offload the UI thread from expensive CPU-bound computation, so that the interface doesn't "freeze" - but in server/API code, where you are operating on ThreadPool threads anyway, Task.Run on an I/O-bound operation simply makes no sense and hurts performance.
Summary - a precise answer in an interview
async/awaiton its own does NOT create new threads. For I/O-bound operations (network, disk, database) .NET uses the operating system's I/O Completion Ports mechanism - no thread is occupied while waiting for the response, which is exactly the foundation of async scalability in a Web API. New (or rather: borrowed from theThreadPool) threads are used only when you explicitly useTask.Run()to offload CPU-bound work - and this is the only scenario in which "async" actually involves occupying a separate worker thread. Confusing these two cases (and wrapping I/O-bound work in an unnecessaryTask.Run) is a common performance anti-pattern.