title: OpenMP task with and without parallel
body: <pre class="lang-cpp prettyprint-override"><code>Node *head = &amp;node1;
  while (head)
  {
      #pragma omp task 
          cout&lt;&lt;head-&gt;value&lt;&lt;endl;
      head = head-&gt;next;
  }
  
  #pragma omp parallel
  {
      #pragma omp single
      {
          Node *head = &amp;node1;
          while (head)
          {
              #pragma omp task 
                  cout&lt;&lt;head-&gt;value&lt;&lt;endl;
              head = head-&gt;next;
          }
      }
  }
  </code></pre>
  
  <p>In the first block, I just created tasks without parallel directive, while in the second block, I used parallel directive and single directive which is a common way I saw in the papers.
  I wonder what's the difference between them? BTW, I know the basic meaning of these directives.</p>
  
  <p>The code in my comment:</p>
  
  <pre><code>void traverse(node *root)
  {
      if (root-&gt;left) 
      {
          #pragma omp task 
          traverse(root-&gt;left);
      }
      if (root-&gt;right) 
      {
          #pragma omp task 
          traverse(root-&gt;right);
      }
      process(root);
  }
  </code></pre>