title: Does using a lock have better performance than using a local (single application) semaphore?
body: <p>Does using a lock have better performance than using a local (single application) semaphore?</p>
  
  <p>I read this blog from msdn : <a href="http://msdn.microsoft.com/en-us/library/yy12yx1f(VS.80).aspx" rel="noreferrer">Producer consumer solution on msdn</a></p>
  
  <p>and I didn't like their solution to the problem because there are always 20 elements left in the queue.</p>
  
  <p>So instead, I thought about using a 'Semaphore' that will be available only in my app (I just won't name it in the constructor), but I don't know how it will effect the app's performance.</p>
  
  <p>Does anyone have an idea if it'll affect the performance? What are the other considerations to use a lock and not 'Semaphore'?</p>