Re: Easier games to play
"I guess your idea of writing multithreaded code is to FORK and manually use IPC, rather than just using async and letting the runtime manage it.
Just because you can spend your life debugging race conditions, doesn't mean you should.
Or is all your code strictly single-threaded, and runs a single processor core at 100% whilst leaving the other 7 idle?"
Async/await in C# is nothing to do with multithreading. When an async function hits an await the function becomes split at that point and the code following gets wrapped as a completion routine which gets processed on the same synchronisation context so execution can return to the caller while it completes during idle time on the same thread. The async modifier indicates that the return result of the function will be wrapped in a Task generic for that type which can be awaited on. The code only becomes multithreaded if you create another Task on which you call Run. In most cases you remain single threaded and your code has full thread affinity. In short async can allow you to make optimum use of the synchronisation context to do different things while waiting whereas multithreading allows you to make use of multiple synchronisation contexts to do things in parallel. The reason async applications which are busy appear to be shared over multiple cores is scheduler hopping which may continue a thread on a different core to the one it was paused on. It's still one thread.