I'm new to multithreading, and I made a simple code through what I have learned while surfing.
Task[] tasks = new Task[B.Col];
for(int j = 0; j < B.Col; j++)
{
tasks[j] = Task.Run(() =>
{
for (int k = 0; k < A.Col; k++)
{
C[i, j] += A[i, k] * B[k, j];
}
});
}
/*
for(int j = 0; j < B.Col; j++)
{
for(int k = 0; k < A.Col; k++)
{
C[i, j] += A[i, k] * B[k, j];
}
}
*/
I want to check if this is the right way to 'multithread'ize the code below. If this code is not that efficient, would you please help me to find a better way?