Previous | Next --- Slide 36 of 65
Back to Lecture Thumbnails
MichaelJordan

The difference between an "atomic" block and lock and unlock comes down to what we've been talking about throughout the semester where there is a difference between abstraction and implementation. One possible implementation for an atomic block is that there can be low level locks and unlocks used to ensure atomicity. Using an "atomic" block is similar to telling ISPC to launch a bunch of tasks - it just lets the compiler know the nature of the code (it's independent or in this case that it needs to appear to be atomic) so that it knows how it can optimize/move things around at a lower level.

mario

An atomic block has transactional semantics and isolations which a lock does not have.

emt

By declaring an atomic block, the programmer is letting the compiler know that that block of code needs to be run atomically, but the compiler ultimately decides how to implement the atomicity. The programmer has no control over the implementation of an atomic block and just cares that the block is indeed atomic.

anonymous

Lock/Unlock is one way to implement the atomic operation, and atomic can also be implemented in other ways like TM. Lock/Unlock can also be used to do other things that atomic cannot achieve.

nishadg

What is an example of something that can't be done with atomic regions but can be done with locks?