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
Parallel.For(0, 10,new ParallelOptions {MaxDegreeOfParallelism=10 } ,i =>
{
        //send to check if open port on any ip
});
Or alternatively:
Thread[] threads = new Thread[10];
for (int i = 0; i < 10; i++)
{
    threads[i] = new Thread(() => 
    {
        //send to check if open port on any ip
    });
}
Or alternatively:
Task[] tasks= new Task[10];
for (int i = 0; i < 10; i++)
{
    tasks[i] = new Task(() => 
    {
        //send to check if open port on any ip
    });
}
 
     
    