Previous | Next --- Slide 35 of 37
Back to Lecture Thumbnails
zckchange

What if not only my program is using the machine, will lock-free still work correctly?

In my opinions, it's not because other programs won't guarantee the operations to ensure correct lock-free.

jocelynh

@zckchange: I believe that it should still work correctly, since a lock-free data structure should just exist within the scope of your program's address space, so other programs that are running on the machine should not be touching it. Lock-free reduces contention for the data structure's resource, but for your own program's threads.

pdp

If the performance of the parallel program is compute bound, then spinning in a while loop for a successful atomic CAS op might hinder performance, in which case code with locks might perform better.