By: Anon (no.delete@this.spam.com), August 23, 2022 6:28 pm
Room: Moderated Discussions
Andrey (andrey.semashev.delete@this.gmail.com) on August 23, 2022 6:01 pm wrote:
> Even a theoretical ideal HTM that has no meaningful restrictions on the contents of the transactional
> region and guarantee forward progress would be conceptually similar to a lock in terms of usage: you have
> to begin and end the transaction, similar to how you acquire and release the lock. You could argue that
> HTM makes the programmer less pressed to resort to lock-free techniques and fine grained locking, but
> the counter argument would be if you are so hard pressed for performance and HTM is fast (or at least
> not much slower) compared to locking in 1-to-1 comparison, you could apply the same techniques but using
> HTM (e.g. use more fine grained transactions) to extract more performance with HTM.
The counter argument is broken, on an actually good implementation (maybe a Magical Unicorn HTM - MUHTM) there is a chance of coarse grained transaction achieving enough performance while fine grained locking does not, so it is theoretically possible for HTM to be both easier and faster than locking.
> Even a theoretical ideal HTM that has no meaningful restrictions on the contents of the transactional
> region and guarantee forward progress would be conceptually similar to a lock in terms of usage: you have
> to begin and end the transaction, similar to how you acquire and release the lock. You could argue that
> HTM makes the programmer less pressed to resort to lock-free techniques and fine grained locking, but
> the counter argument would be if you are so hard pressed for performance and HTM is fast (or at least
> not much slower) compared to locking in 1-to-1 comparison, you could apply the same techniques but using
> HTM (e.g. use more fine grained transactions) to extract more performance with HTM.
The counter argument is broken, on an actually good implementation (maybe a Magical Unicorn HTM - MUHTM) there is a chance of coarse grained transaction achieving enough performance while fine grained locking does not, so it is theoretically possible for HTM to be both easier and faster than locking.