Some C# classes that do mysterious threading things.
Do not browse the source code if you want to solve the mysteries!
Please install the .NET SDK version 8:
- either by visiting the download page; or
- by executing the script dotnet-install.sh in this repository (this is the official Microsoft .NET installation script.)
Make sure that the dotnet executable is in your environment variables.
To test, run the following command from the root folder of this repository:
Enter each mystery and run the compiled code using
There (up to) are three variants for each mystery.
- What do you observe when running the different variants?
- Do they behave the same?
- Are they predictable?
- Can you form a theory about the underlying implementation?
Threading mysteries are strongly inspired by:
- Shriram Krishnamurthi's Mystery Languages; and
- the paper Teaching Programming Languages by Experimental and Adversarial Thinking.
Threading variants are based on:
- Brian Goetz' Java Concurrency in Practice; and
- Peter Sestoft's course Practical Parallel and Concurrent Programming (note that there exist more recent versions of the course).
The vending machine analogy is due to Bent Thomsen.
Threading mysteries were developed at SimCorp A/S for the OTC Core Knowledge Sharing series.