i just have a quick question about concurrent programming in Java.
for example,
i have a NxN matrix, and there is a corresponding thread for each row of the matrix, if there is no interaction between threads in each row, is it safe (or correct) if multiple threads access and modify separate rows of the matrix simultaneously?
Thanks!!
i just have a quick question about concurrent programming in Java. for example, i
Share
If you are only doing reads of the matrix, it is always safe. If you are doing writes, but a thread only reads and writes to the row it is assigned, it is safe. It is only if you have a thread reading from a cell written by another thread that you have to worry about locks.