java - multiple threads accessing on a matrix -
i' m implementing multithreading programme in java, threads can come in in rows or columns concurrently.
example code, little snippet show doubt:
public void checkrow(int row){ for(int j = 0; j < numberofcolumns;i++){ if(matrix[row][j]...) } } public void checkcolumn(int column){ for(int = 0; < numberofrows;i++){ if(matrix[i][column]...) } }
and have 2 separate thread loops
public void run(){ matrixclass.checkrow(2); } public void run(){ matrixclass.checkcolumn(3); }
my question is, i' m reading matrix if threads illustration reaches same bucket wrong happen?
thanks in advance.
as long reading matrix, it's ok, assuming though, has been safely initialized , no modification permitted.
java multithreading
No comments:
Post a Comment