What is transactional memory?

前端 未结 3 1532
梦谈多话
梦谈多话 2021-02-04 04:24

I\'m confused because from reading the wiki page it seems like just having a checkValidate and commit system for loads and stores. Is the purpose to solve synchronization proble

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-04 05:06

    At the implementation level, transactional memory is part of the cache layer. It allows software to "try" some operations on memory, and then "commit" them later only if no other multiprocessors in the system modified any of the memory that was read or written. In very parallel SMP environments where most accesses don't collide, this can be faster than having all threads locking the same (highly contended) synchronization primitives.

    It makes the task of the application programmer more difficult, though, because the software has to be able to recover ("rollback") the transaction if the commit fails.

提交回复
热议问题