5 ms·
Not sure if folks here have had a chance to look at this : http://queue.acm.org/detail.cfm?id=1454466 http://queue.acm.org/detail.cfm?id=1454466 ? Would be very
by signa11 11y ago
Not sure if folks here have had a chance to look at this : http://queue.acm.org/detail.cfm?id=1454466 http://queue.acm.org/detail.cfm?id=1454466 ? Would be very interested to get your thoughts on this.
- gpderetta 11y agoThe paper dismiss TM as not mature enough and not worth the cost. Since the paper publication (2008), HTM support was added on a few mainstream CPUs (intel, power). Also, TM is likely to be in the next C++ standard: the specification has been published as Technical Report (GCC already implements a slightly older draft) and handles many of the issues identified in the paper, in particular its interaction with non-transactional atomic operations and exceptions. Mind you, TM might still end up not being worth the trouble, but at least there is a serious ongoing effort to push it into a mainstream language. I believe that, among the authors of the paper, at least Magel Michael was involved in the C++ Transactonal Memory TR.
- signa11 11y agothanks to both gpderetta and chrisseaton for their insightful replies. as i was looking for more sources of information, i stumbled upon this: http://kukuruku.co/hub/cpp/transactional-memory-history-and-development http://kukuruku.co/hub/cpp/transactional-memory-history-and-... where we see a large number of folks trying and eventually giving up on tm both in h/w and s/w implementations e.g. sun tried adding tm support to their sparc(rock)-v9 processor, but after oracle bought them, the project was shelved for “This processor had two astonishing features: it was incredibly low and consumed plenty of energy. It was so hot that they had to hang 12 inches of cooling fans so that processor wouldn’t overheat. It would have been insane to continue this project.” to me at least, it seems that optimistic-reads with in-place pessimistic writes and automatic retries a.k.a weakly-atomic-update-in-place (raison d'être for tm) is the biggest torpedo in tm's direction. for example, assume we have : ---x---x---x---x---x---x---x---x---x bool owning_obj = false; some_obj x = new some_obj(); /* txn-0 */ atomic { owning_obj = true; } int z = x.some_value; ---x---x---x---x---x---x---x---x---x /* txn-1 */ atomic { if (!owning_obj) x.some_value = 12314; } ---x---x---x---x---x---x---x---x---x ok, so now we have a problem :), specifically : although txn-1 would rollback, because the value of owning_obj is changed, but it is too late. the other thread using x (txn-0) will see a constantly changing state. who knows what will happen next. it might be possible to have some kind of RCU semantics here, where you wait for a quiescent state to be reached, but that would be pretty complicated. may you please provide your comments ? it is all very educational :)
- continuational 11y agoThat's not how TM is supposed to work; it should not be possible for one atomic block to observe an uncommitted write of another atomic block. It must act as if each atomic block acquires a single global lock, executes, and then releases the lock so that other atomic blocks may execute. The challenge is to emulate this without actually using a single global lock.
- signa11 11y ago> That's not how TM is supposed to work; it should not be possible for one atomic block to observe an uncommitted write of another atomic block. well, transactions need to be atomic w.r.t each other, but what about their relationship to non-transactional code ? it might appear that this is just an 'implementation' detail, but, programs can contain unprotected references to shared variables (i.e., outside transactions) without creating malignant data races. so, both transactional and non-transactional code can refer to the same data. this is where the notion of strong and weak atomicity comes from, and which is what the pseudo code was trying (probably unsuccessfully) to show.
- chrisseaton 11y agoAround 2008 when that article was written was the peak of the hype of transactional memory. Many people thought it could be used by normal programmers placing atomic blocks around arbitrarily complex code using any data structures from the whole program. Some people even thought code could be in transactions by default all the time, committed with 'commit' statements periodically. That article should be read with that context in mind. Now that transactional memory has fallen well out of fashion and people are being a bit more realistic I think it's more likely it will be applied by experts as a kind of multi-word compare and swap, for implementing specific data structures with some support for composability. Which of course would still be a gain for software engineering. This C++ work could support that kind of use-case.