ManualResetEventSlim recommended wait time ManualResetEventSlim recommended wait time multithreading multithreading

ManualResetEventSlim recommended wait time


This is what I found and would love for someone else to validate this, but this is what I found while reading the Reference Source for ManualResetEventSlim

ManualResetEventSlim
It is attempting to just sleep and yield based on the number of processors and doing extremely short sleeps -- 1ms or 0ms depending on its current spin index. If it still hasn't been enough time, it will then revert to using Monitor.Wait using a new updated version of the timeout that was originally passed in.

Passing in 0 for Thread.Sleep relieves its time slice.

ManualResetEvent
It uses WaitHandle and calls native methods to handle waiting for the specified time. Unfortunately, I am unable to see what it is doing.

My Conclusion
"Very Short" means just a few milliseconds.

EDIT: I just found these which have lots of information:


The scale from CPU cache to RAM and to Kernel is approximately logarithmic. Say you can do 400 cycles using CPU cache or 20 CPU cycles using reading / writing RAM or 1 kernel operation. The numbers will depend on hardware, it's just an estimate.

If you think that maximum wait times will be less than 6-15 ns (~20-50 CPU cycles @ 3GHz) than it's a small wait time.