title: Lock (Monitor) internal implementation in .NET
body: <p>For mastering of some technology you have to know how it's made at one abstraction level lower. In case of multithreading programming, it will be good to know about synchronization primitives.<br>
  Here is the question, how implemented Lock (Monitor) in .NET? </p>
  
  <p>I'm intrested in such points:<br>
  - does it utilize OS objects?;<br>
  - does it require user mode or kernel mode?;<br>
  - what is overhead for threads that are waiting for lock?;<br>
  - in what cases threads queue that awaiting for the lock could be violated?.</p>
  
  <p><strong>Updated:</strong><br>
  "If more than one thread contends the lock, they are queued on a “ready queue” and granted the lock on a first-come, first-served basis. <em>Note: Nuances in the behavior of Windows and the CLR mean that the fairness of the queue can sometimes be violated.</em>" [C# 4.0 in a Nutshell, Joseph Albahari] So this is what I'm asking about in last question concerning 'violated queue'.</p>