Difference in usage and implementation of ManualResetEvent(Slim), Semaphore(Slim) and ReaderWriterLock(Slim)

ReaderWriterLockSlim is a better version of ReaderWriterLock that is faster and doesn't suffer from writer starvation

ManualResetEventSlim and SemaphoreSlim are fully managed versions of a ManualResetEvent and Semaphore that spin-wait for a while before falling back to kernel objects, and so are faster than the old versions when wait times are short.


Here are some great illustrations explaining the "flow" of these sync primitives. These might be useful to give a more concrete understanding of these terms (Taken from the this blog)

SemaphoreSlim

enter image description here

CountdownEvent

enter image description here

Barrier

enter image description here

ManualResetEventSlim

enter image description here


To quote directly from the documentation

"In the .NET Framework version 4, you can use the System.Threading.ManualResetEventSlim class for better performance when wait times are expected to be very short, and when the event does not cross a process boundary"