title: difference between omp critical and omp single
body: <p>I am trying to understand the exact difference between <code>#pragma omp critical</code> and <code>#pragma omp single</code> in OpenMP:</p>
  
  <p>Microsoft definitions for these are:</p>
  
  <ul>
  <li>Single: Lets you specify that a section of code should be executed on
  a single thread, not necessarily the master thread.</li>
  <li>Critical: Specifies that code is only be executed on one thread at a
  time.</li>
  </ul>
  
  <p>So it means that in both, the exact section of code afterwards would be executed by just one thread and other threads will not enter that section e.g. if we print something, we will see the result on screen once, right?</p>
  
  <p>How about the difference? It looks that critical take care of time of execution, but not single! But I don't see any difference in practice! Does it mean that a kind of waiting or synchronization for other threads (which do not enter that section) is considered in critical, but there is nothing that holds other threads in single? How it can change the outcome in practice?</p>
  
  <p>I appreciate if anyone can clarify this to me especially by an example. Thanks!</p>