Threads, tasks, synchronisation primitives, advanced async patterns and the concurrency problems seen in production .NET systems.
-
What is SpinLock, and when (if ever) should you use it instead of lock?
SpinLock and SpinWait, busy-waiting versus blocking, struct copying pitfalls, owner tracking and why most code should not use it.
Senior
Theory
Synchronization
Β· π 3 follow-ups Β· π 1 real-world
-
When would you use ReaderWriterLockSlim, and what are its pitfalls compared with lock or immutable snapshots?
Read, write and upgradeable read locks, recursion policy, thread affinity, performance reality and lock-free alternatives for read-mostly data.
Senior
Theory
Synchronization
Β· π 3 follow-ups Β· π 1 real-world
-
What does the Interlocked class do, and how do you build a lock-free update with CompareExchange?
Atomic Increment, Add, Exchange, CompareExchange, Read, And and Or; full fences; CAS loops; ABA and when lock-free is worth it.
Senior
Coding
Synchronization
Β· π 3 follow-ups Β· π 1 real-world
-
What does volatile mean in C#, and how do Volatile.Read and Volatile.Write differ from Interlocked?
Compiler and CPU reordering, acquire and release semantics, the volatile keyword, Volatile class, x64 versus Arm64 memory models and what volatile does not guarantee.
Senior
Theory
Synchronization
Β· π 2 follow-ups Β· π 1 real-world
-
What are memory barriers, why do CPUs and compilers reorder memory operations, and how does .NET expose barriers?
Store buffers and reordering, full versus half fences, Interlocked.MemoryBarrier, implicit barriers in locks and Interlocked, double-checked locking and MemoryBarrierProcessWide.
Staff / Architect
Theory
Synchronization
Β· π 3 follow-ups Β· π 1 real-world
-
What is a SynchronizationContext, which .NET app models have one, and how does it cause the classic async deadlock?
SynchronizationContext Post and Send, UI and legacy ASP.NET contexts, ASP.NET Core having none, and the blocking-on-async deadlock.
Senior
Debugging
Async Advanced
Β· π 2 follow-ups Β· π 1 real-world
-
What does ConfigureAwait(false) do, when should you use it, and what are ConfigureAwaitOptions in .NET 8+?
Context capture, library versus application code, the already-completed caveat, ASP.NET Core relevance, CA2007 and ConfigureAwaitOptions.
Mid-Level
Theory
Async Advanced
Β· π 2 follow-ups Β· π 1 real-world
-
How does cooperative cancellation with CancellationToken work in .NET, and how do you design APIs that support it?
CancellationTokenSource and token, ThrowIfCancellationRequested, Register, OperationCanceledException, RequestAborted in ASP.NET Core, disposal and where not to cancel.
Mid-Level
Coding
Async Advanced
Β· π 3 follow-ups Β· π 1 real-world
-
What are linked cancellation tokens, and how do you combine a caller's token with your own timeout safely?
CreateLinkedTokenSource, disposal to avoid leaks, telling which source fired, and combining request, shutdown and timeout cancellation.
Senior
Coding
Async Advanced
Β· π 2 follow-ups Β· π 1 real-world
-
How do you handle timeouts correctly in async .NET code, from HttpClient to ASP.NET Core requests?
CancelAfter, WaitAsync, HttpClient.Timeout, resilience handlers, ASP.NET Core request timeouts middleware, TimeProvider and layered timeout budgets.
Senior
RealWorldScenario
Async Advanced
Β· π 2 follow-ups Β· π 1 real-world
-
What are async streams and IAsyncEnumerable of T? How do you produce, consume and cancel them?
Async iterators with yield return and await, await foreach, EnumeratorCancellation, ConfigureAwait, LINQ over async streams in .NET 10, EF Core and ASP.NET Core streaming.
Senior
Coding
Async Advanced
Β· π 3 follow-ups Β· π 1 real-world
-
What are System.Threading.Channels, and how would you build a bounded producer/consumer pipeline with them?
Bounded and unbounded channels, full modes, single reader and writer options, completion, ReadAllAsync and backpressure in background processing.
Senior
Coding
Async Advanced
Β· π 3 follow-ups Β· π 1 real-world
-
What is TPL Dataflow, and when would you choose it over Channels or Parallel.ForEachAsync?
Dataflow blocks, linking with completion propagation, MaxDegreeOfParallelism, BoundedCapacity, SendAsync versus Post, batching and when it is the right tool.
Senior
Architecture
Async Advanced
Β· π 2 follow-ups Β· π 1 real-world
-
What is PLINQ, when does AsParallel help, and when does it make things worse?
Parallel LINQ partitioning, degree of parallelism, ordering, merge options, cancellation, exceptions, and why it is for CPU-bound work only.
Mid-Level
Theory
Async Advanced
Β· π 2 follow-ups Β· π 1 real-world
-
How does Parallel.ForEachAsync work, and how does it compare with Task.WhenAll and SemaphoreSlim for concurrent I/O?
Parallel.ForEachAsync in .NET 6+, MaxDegreeOfParallelism defaults, cancellation and exception behaviour, collecting results, Parallel.ForAsync and alternatives.
Mid-Level
Coding
Async Advanced
Β· π 3 follow-ups Β· π 1 real-world
-
A .NET service hangs with no CPU usage. How do you diagnose and fix a deadlock, whether it comes from locks or from async code?
Deadlock conditions, lock-ordering and async deadlocks, diagnosis with dotnet-dump (syncblk, clrstack, parallelstacks, dumpasync) and prevention.
Senior
Debugging
Concurrency Production Problems
Β· π 3 follow-ups Β· π 1 real-world
-
What is a race condition? Give examples in .NET, including async and database races, and explain how you find and fix them.
Check-then-act and read-modify-write races, non-thread-safe collections, async interleaving, lost updates in databases, and detection and fixes.
Senior
Debugging
Concurrency Production Problems
Β· π 3 follow-ups Β· π 1 real-world
-
How do you recognise, diagnose and fix ThreadPool starvation in a production ASP.NET Core service?
Starvation symptoms, Kestrel heartbeat warnings, dotnet-counters and dotnet-trace evidence, dump analysis, root causes and short- versus long-term fixes.
Senior
Debugging
Concurrency Production Problems
Β· π 3 follow-ups Β· π 1 real-world
-
What is async-over-sync, why is wrapping synchronous code in Task.Run often a mistake, and when is it acceptable?
Fake async wrappers, why they do not scale on servers, when offloading is right (UI responsiveness), and how to integrate blocking legacy SDKs safely.
Senior
Architecture
Concurrency Production Problems
Β· π 3 follow-ups Β· π 1 real-world
-
What is sync-over-async, where does it sneak into .NET code, and how do you remove it?
Blocking on tasks with .Result, .Wait and GetResult; hidden places such as constructors, DI factories, Dispose and sync interfaces; async initialisation patterns and safe boundaries.
Senior
CodeReview
Concurrency Production Problems
Β· π 3 follow-ups Β· π 1 real-world