So, let's say I have 4 threads, and they all go through an array with 100 indices, flipping a bit of information in each index and writing back that index ...
arr[];
Thread 1:
for (int i = 0; i< 100; i+=4) { flip bits of arr[i]}
Thread 2:
for (int j = 1; j< 100; j+=4) { flip bits of arr[j]}
Thread 3:
for (int k = 2; k< 100; k+=4) { flip bits of arr[k]}
Thread 4:
for (int l = 3; l< 100; l+=4) { flip bits of arr[l]}
I'm a complete noob in concurrency, so I was wondering if this was good practice or was there another way to do this?
UPDATE: , - - "flip bits of arr [i]" "flip bits of arr [j]" /, " " ( ), , j , .