Previous | Next --- Slide 39 of 47
Back to Lecture Thumbnails
jessicaaa

From the lecture, since all threads share this one diff, and all read and write should be atomic, the lock is needed here. However, since we're running this lock every iteration, it might be even more expensive taking a lock here than doing the math operations in this case.

Please log in to leave a comment.