Join Nostr
2026-10-16 06:38:04 UTC

codementor on Nostr: Learn: Task vs Thread A Thread is an operating system thread: expensive to create, ...

Learn: Task vs Thread

A Thread is an operating system thread: expensive to create, and it holds memory the whole time.
A Task is a promise of a result. CPU work started with Task.Run runs on a shared pool of threads. A task waiting for I/O (a web call, a database) holds no thread at all while it waits.

In modern C#, use Task and async/await; create a Thread yourself only for rare long-running, dedicated work.

Read more: https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-based-asynchronous-programming

#tip · TIP-045