World Congress 2022 • Jun 15, 2022

Asynchronicity and multithreading in C#

Grzegorz Lang

Are you still manually spawning threads in C#? Discover why blocking threads kills performance and how mastering modern async/await patterns maximizes server throughput.

Pause
Mute Enter Fullscreen
#1 about 4 min

Multithreading basics and physical versus logical threads

Multithreading handles CPU-intensive work by delegating calculations to limited physical and logical worker threads.

#2 about 2 min

Managing thread allocation using the dotnet thread pool

The dotnet thread pool prevents system overload by managing thread lifecycle and task abstractions.

#3 about 2 min

Avoiding blocked threads during ongoing background calculations

Using synchronous result properties freezes physical threads instead of safely continuing execution after task completion.

#4 about 2 min

Recommended abstractions for starting tasks and background work

Defaulting to modern task abstractions prevents common thread initialization mistakes and configuration errors.

#5 about 2 min

Implementing cancellation tokens to terminate long running operations

Cancellation tokens safely interrupt background services and clean up allocated resources upon request.

#6 about 3 min

Synchronizing background calculations with user interface rendering contexts

Synchronization contexts ensure that background thread calculations safely update interface components on the primary environment thread.

#7 about 2 min

Using task schedulers to route background thread execution

Task schedulers collaborate with environment contexts to determine where and how asynchronous operations execute.

#8 about 4 min

Avoiding locked resources during database and network requests

Asynchronous patterns release threads to the pool during input and output delays instead of waiting idle.

#9 about 3 min

Compiler state machines and asynchronous concurrent task execution

The compiler transforms asynchronous methods into state machines that easily resume task execution upon network completion.

#10 about 1 min

Preventing hidden errors by avoiding asynchronous void return types

Asynchronous methods lacking a measurable return type swallow exceptions and prevent accurate execution tracking.

#11 about 2 min

Reducing heap allocations by implementing value task structures

Value tasks optimize execution paths by avoiding heap allocations during highly frequent concurrent calculations.

#12 about 2 min

Modifying asynchronous synchronization context configurations for software libraries

Disabling context capture in background tasks ensures agnostic library environments without unnecessary interface thread coupling.

#13 about 4 min

Clarifying asynchronous patterns and modern framework implementation differences

Understanding synchronization context changes in modern frameworks helps mitigate common thread blocking mistakes during implementation.

Matching moments

4:13 min

Awaiting async void methods with custom task schedulers

Adam Furmanek · LIVE

3:57 min

Enforcing performant threading models at the framework level

Xuan Huang Xuan Huang · World Congress 2025

1:34 min

Shift away from traditional threads and the asynchronous era

Ivan Šarić Ivan Šarić · Europe 2026 Virtual

5:10 min

Audience Q&A on arrow functions and multithreading

Rob Richardson · JS Congress

3:32 min

Managing asynchronous operations and concurrent multithreading with isolates

Christoph Christoph · World Congress 2024

4:16 min

Implementing cooperative multitasking in modern programming languages

Mikhail Maslo · World Congress 2023

Upcoming sessions on this topic

Open session

React Under Fire: Rendering Performance for Streaming Agent UIs

  • Abhirupa Mitra

    Slack

    Senior Member of Technical Staff

Open session

Multi-Cloud Isn't a Project. It's a Side Effect.

  • Antonio Mendoza Pérez

    Temporal Technologies

    Staff Developer Success Engineer

  • Gaurav Thadani

    Temporal

    Staff Developer Success Engineer

Open session

How We Cut Our API's p99 Latency from Minutes to Under a Second

  • Deepak Agrawal

    Atlassian

    Principal Software Engineer

Open session

Designing for Every Direction: Logical CSS for Global, Adaptive, and Effortlessly Reversible UIs

  • Vidhya Krishnamoorthy

    Morgan Stanley

    VP, Software Engineering Manager

Open session

How 8 GPUs Became 16: Rethinking LLM Inference Through Parallelism, Memory, and Runtime Design

  • Purnima Kumari

    DigitalOCean

    Sr. Solutions Architect II

Open session

AI Is the Easy Part: Why Faster Engineers Don't Make Faster Businesses

  • Bharat Sharma

    Booking

    Senior Engineering Manager