The 15 ways of doing concurrency in .NET

A reliable source told me that there are 15 ways to do concurrency in .NET. The goal of this post is to write them all down with a brief note for each.

I am not an expert in concurrency , so will not succeed without your help. Do you know one that I missed? Tell me on Twitter @dicshaunary .

  1. Task-based Asynchronous Pattern (TAP).
    • This includes the await syntactic sugar.
    • See MSDN .
  2. Event-based Asynchronous Pattern (EAP).
    • This is the MethodNameAsync and MethodNameCompleted pattern.
    • See MSDN .
  3. Asynchronous Programming Model (APM).
    • This is the BeginOperationName and EndOperationName pattern.
    • See MSDN.
  4. Background Worker.
    • Run an operation on a dedicated, separate thread.
    • See MSDN.
  5. Interlocked.
    • Run atomic operations on variables that exist on multiple threads.
    • “Lock free concurrency.”
    • See MSDN.
    • Thank you @lwischik
  6. Raw Threading.
  7. Parallel Linq.
  8. Thread Pooling.
  9. Process.
  10. Parallel Loops.
  11. Control.MailBoxProcessor<`Msg>. (F#).
  12. Reactive Extensions.
  13. Action Block
  14. Monitor.Wait & Monitor.Pulse with Plain Old Locks
  15. Plain Old Locks

Know one that isn’t listed? Help the list reach 15 on Twitter @dicshaunary .

Thank you to Lucian for starting the conversation.

TODO