350

Optimistic Transactions vs. Pessimistic Locks

Vincent Gramoli
Abstract

To leverage modern multi-cores, hardware manufacturers have recently introduced transactional memory that adopts an optimistic computing strategy, complementing classical (pessimistic) locking techniques. Yet, it is unclear which synchronization technique can lead to higher concurrency. In this paper, we compare the level of concurrency one can obtain by converting a sequential program into a concurrent one using optimistic or pessimistic techniques. We introduce a new correctness criterion for concurrent programs, defined independently of the synchronization techniques they use. This criterion requires the program's executions to be (1) locally serializable at the memory level, in that each process observes a potentially different but sequential execution, and (2) linearizable at the high level (exported to the application). We treat a program's concurrency as its ability to accept a concurrent schedule, a metric inspired by the theories of database and transactional memory. We show that pessimistic locking can provide strictly higher concurrency than transactions for some applications whereas transactions can provide strictly higher concurrency than pessimistic locks for others. Finally, we show that combining the benefits of the two synchronization techniques can provide strictly more concurrency than any of them individually.

View on arXiv
Comments on this paper