Previous | Next --- Slide 41 of 47
Back to Lecture Thumbnails
kayvonf

Question: Why does this code contain a lock?

pmassey

@kayvonf Because if there wasn't a lock, two particles could try to append themselves to the same cell_list at the same time, and only one of them would be saved to the global cell_list. It's the same reason we need atomic additions for multi-worker summation.