title: The correct way to apply parallel programming on cores
body: <p>What is the correct way to distribute operations to cores. Where I have four cores. I tried these codes. I don’t know if there is a better way. I hope for help</p>
  
  <pre><code>Parallel.For(0, 10,new ParallelOptions {MaxDegreeOfParallelism=10 } ,i =&gt;
  {
          //send to check if open port on any ip
  });
  </code></pre>
  
  <p>Or alternatively:</p>
  
  <pre><code>Thread[] threads = new Thread[10];
  for (int i = 0; i &lt; 10; i++)
  {
      threads[i] = new Thread(() =&gt; 
      {
          //send to check if open port on any ip
      });
  }
  </code></pre>
  
  <p>Or alternatively:</p>
  
  <pre><code>Task[] tasks= new Task[10];
  for (int i = 0; i &lt; 10; i++)
  {
      tasks[i] = new Task(() =&gt; 
      {
          //send to check if open port on any ip
      });
  }
  </code></pre>