In this work, we present transaction polymorphism, a synchronization technique that provides more control to the programmer than traditional (i.e., monomorphic) transactions to achieve comparable performance to generic lockbased and lock-free solutions.We prove the following results: (i) Lock-based synchronization enables strictly higher concurrency than monormophic transactions. (ii) Polymorphic transactions enable strictly higher concurrency than monomorphic transactions. The former result indicates that there exist some transactional programs that will never perform as well as their lockbased counterparts, whatever improvement could be made at the hardware level to diminish the overhead associated with transactional accesses. The latter result shows, however, that transaction polymorphism is a promising solution to cope with this issue.
Categories and Subject Descriptors
TRANSACTIONS FOR EXPERTSLock-based and lock-free concurrent implementations of abstract data types are often highly tuned to support a fixed set of efficient features, however, it is difficult to adapt them as they are not generic. For example, a hash table synchronizes efficiently concurrent insert, remove, and contains operations, as long as the number of elements remains proportional to the number of buckets [3]. Unfortunately, this data structure does not support a resize, therefore it is preferable to use a split ordered linked list [4] if one expect the structure to be unbalanced or overloaded.Copyright is held by the author/owner(s). SPAA'11, June 4-6, 2011, San Jose, California, USA. ACM 978-1-4503-0743-7/11/06.The transaction paradigm is an appealing programming idiom for it guarantees to execute in isolation from the other existing transactions. Provided that every operation of an abstract data type is implemented as a transaction, any new operation encapsulated within a transaction will also be atomic. Hence, a novice programmer could reuse such a concurrent library straightforwardly to write other transactionbased concurrent programs. Concurrent programming with transactions is simple in part for this reason and because it consists in delimiting regions of sequential code (e.g., starting with a start delimiter). As a drawback, transactions limits concurrency by preventing the programmer from giving hints on the semantics of any transaction. Instead, all transactions execute the same safest semantics-we refer to them as monomorphic.We propose transaction polymorphism a novel synchronization technique that allows multiple transactions, with distinct semantics, to run concurrently. To support polymorphism, a transactional memory has simply to accept a semantic parameter p when each transaction starts, e.g., start(p). The application programmer can either set p to the desired semantics or omit it and the default semantics def will be used for the corresponding transaction. Transactional polymorphism has various applications in concurrent programming ranging from providing one liveness guarantee per transaction to distinguishi...