Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Concurrent Work in C# with Task.WhenAll and Task.WhenAny
Async code is not concurrent by itself: awaiting independent work one by one adds the durations up. Starting first and waiting later, getting ordered results with Task.WhenAll, the trap of starting tasks twice with LINQ Select, WhenAll waiting for everyone after a failure, first answer and timeouts with WhenAny, losers that keep running, and processing tasks as they complete.
C# Synchronization: lock, Interlocked, SemaphoreSlim and Concurrent Collections
Why sold++ never reaches a million: race conditions and the check-then-act race. The rules of lock and why you can't await inside it, atomic counters and CompareExchange with Interlocked, the SemaphoreSlim pattern for an async cache, ConcurrentDictionary factories that run more than once and the Lazy<T> fix.