C# – Using ManualResetEventSlim and AutoResetEvent to signal waiting threads

In software development there are many ways to solve the same problem. It’s all about knowing what options are available and using the simplest approach for the job. When you want one or more threads to wait until they are signaled before continuing, how do you do it? There are many options that you can … Read more

C# – How to make concurrent requests with HttpClient

The HttpClient class was designed to be used concurrently. It’s thread-safe and can handle multiple requests. You can fire off multiple requests from the same thread and await all of the responses, or fire off requests from multiple threads. No matter what the scenario, HttpClient was built to handle concurrent requests. To use HttpClient effectively … Read more

Multithreaded quicksort in C#

One day I decided to challenge myself by trying to implement multithreaded quicksort. I wanted to see how it would compare to the built-in sort function – Array.Sort(). I came up with two algorithms that were 2-4x faster than Array.Sort(): Top-down: divide-fork-sort-merge Bottom-up: quicksort with fork-on-recursion After continuing to tinker, in attempts to further optimize, … Read more