Previous | Next --- Slide 34 of 60
Back to Lecture Thumbnails
juliewang

Transactional memory seems way easier to use and better than locks. Is this the programming model that is dominant in parallel code? i.e. When writing C++ code, should you always be using atomic blocks instead of manually locking and unlocking?

legoat

In general, it seems like atomic operations should be faster since they make use of low-level processor instructions. I think that when thread contention is low, these atomic operations do outperform manually locking/giving up locks.

legoat

As for transactional memory in particular, I don't think it is the dominant model yet, although some studies do indicate that it might improve productivity: https://dl.acm.org/doi/10.1145/1989493.1989500

rahulahoop

@juliewang Slide 36 gives an example in which locks work but atomic does not.

Please log in to leave a comment.