In 2004, the Dutch innovation center MediaPlaza invited me to join them to build a supermarket shelf for the Shop Of The Future.
The shelf had built-in RFID antennas and could automatically detect when products where placed on or taken off the shelf. We also added LCD displays with dynamic pricing and monitors to display context-aware commercials. It looked like this:
I wrote all of the multi-threaded C# code to drive the RFID antennas and automatically detect when groceries fitted with an RFID tags were placed on the shelves.
The shelf was very popular with crowds, but it had a flaw: the code occasionally crashed during initialization. We managed to temporarily work around the problem by rebooting the shelf a couple of times. Eventually it would start up and work normally.
I tracked the problem down and found an issue with the Windows driver for the RFID antenna. Even though the vendor swore that his driver was completely thread-safe, I managed to crash it repeatedly by calling its initialization method simultaneously on two threads.
So this was obviously some kind of race condition inside the driver. The fix was simple - all I had to do is make the initialization a critical section by running my initialization code inside a lock statement.
If the words in bold are all Greek to you, then this is the course for you!
Writing multi-threaded code is pretty hard. The sobering truth is that if you do not know what you're doing, your code is pretty much guaranteed to crash spectacularly in production. But if you have a good understanding of multi-threaded programming and follow a few simple industry best practices, you can write robust code that can take a beating.
"This is an excellent resource on multi-threading"
- Gary Jarvis, course student
In a series of short lectures I will cover many multi-threading topics. I will show you all of the problems you can expect in asynchronous code, like race conditions, deadlocks, livelocks and synchronisation issues. I'll show you quick and easy strategies to resolve these problems.
By the end of the section you will be able to write robust multi-threaded C# code that can take a beating.
Then we'll move on - I’ll show you how trivially easy it is to write asynchronous C# code using the Task Parallel Library and Parallel LINQ. These amazing frameworks allow anyone to write robust multi-threaded code that can take a beating.
By the end of the course you will be fluent in using Threads, the Tasks Parallel Library, and Parallel LINQ.