We consider greedy contention managers for transactional memory for M x N execution windows of transactions with M threads and N transactions per thread. Assuming that each transaction conflicts with at most C other transactions inside the window, a trivial greedy contention manager can schedule them within CN time. In this paper, we show that there are much better schedules. We present and analyze two new randomized greedy contention management algorithms. The first algorithm Offline-Greedy produces a schedule of length O(C + N log(MN)) with high probability, and gives competitive ratio O(log(MN)) for C <= N log(MN). The offline algorithm depends on knowing the conflict graph. The second algorithm Online-Greedy produces a schedule of length O(C log(MN) + N log^2(MN)) with high probability which is only a O(log(NM)) factor worse, but does not require knowledge of the conflict graph. We also give an adaptive version which achieves similar worst-case performance and C is determined on the fly under execution. Our algorithms provide new tradeoffs for greedy transaction scheduling that parameterize window sizes and transaction conflicts within the window.
Multi-core architectures present both an opportunity and challenge for multi-threaded software. The opportunity is that threads will be available to an unprecedented degree, and the challenge is that more programmers will be exposed to concurrency related synchronization problems that until now were of concern only to a selected few. Writing concurrent programs is difficult because of the complexity of ensuring proper synchronization. Conventional lock based synchronization suffers from well known limitations, so researchers considered non-blocking transactions as an alternative. Software Transactional Memory [15,7,8] systems use lightweight and composable in-memory software transactions to address concurrency in multi-threaded systems ensuring safety all the time [5,6].
A contention management strategy is responsible for the STM system as a whole to make progress. If transaction T discovers it is about to conflict with T ′ , it has two choices, it can pause, giving T ′ a chance to finish, or it can proceed, forcing T ′ to abort. To solve this problem efficiently, T will consult the contention manager module which choice to make. Of particular interest are greedy contention managers where a transaction starts again immediately after every abort. Several (greedy) contention managers have been proposed in the literature. However, most contention managers have been assessed only experimentally by specific benchmarks. There is a small amount of work in the literature which analyzes formally the performance of contention managers. The competitive ratio results are not encouraging since the bounds are not tight. For example with respect to the O(s) bound in [2], when the number of resources increases, the performance degrades linearly. A question arises whether someone can achieve tighter bounds. A difficulty in obtaining tight bounds is that the algorithms studied in [2,4,3,13,14] apply to the one-shot scheduling problem, where each thread issues a single transaction. One-shot problems can be related to graph coloring. It can be shown that the problem of finding the chromatic number of a graph can be reduced to finding an optimal schedule for a one-shot problem. Since it is known that graph coloring is a very hard problem to approximate, the one-shot problem is very hard to approximate too [14].
In order to obtain better formal bounds, we propose to investigate execution window of transactions (see the left part of Figure 1), which has the potential to overcome the limitations of coloring in certain circumstances. An M × N window of transactions W consists of M threads with an execution sequence of N different transactions per thread. Let C denote the maximum number of conflicting transactions for any transaction in the window (C is the maximum degree of the respective conflict graph of the window). A straightforward upper bound is min(CN, M N ), since CN follows from the observation that each transaction in a thread may be delayed at most C time steps by its conflicting transactions, and M N follows from the serialization of the transactions. If we partition the window into N one-shot transaction sets, each of size M , then the competitive ratio using the one-shot analysis results is O(sN ). When we use the Algorithm RandomizedRounds [14] N times then the completion time is in the worst case O(CN log n) (for some appropriate choice of n). We have results that indicate that we can obtain better bounds under certain circumstances in the window. We present two randomized greedy algorithms transactions are assigned priorities values, such that for some random initial interval in the beginning of the window W each transaction is in low priority mode and then after the random period expires the transactions switch to high priority mode. In high priority mode the transaction can only be aborted by other high priority transactions. The random initial delays have the property that the conflicting transactions are shifted inside their window and their execution times may not coincide (see the right part of Figure 1). The benefit is that conflicting transactions can execute at different time slots and potentially many conflicts are avoided. The benefits become more apparent in scenarios where the conflicts are more frequent inside the same column transactions and less frequent between different column transactions.
Transactional Memory (TM) has been proposed in the early nineties as an alternative implementation of mutual exclusion that avoids many of the drawbacks of locks (e.g., deadlock, reliance on the programmer to associate shared data with locks, priority inversion, and failures of threads while holding locks) [8]. A few years later the term Software Transactional Memory (STM) was suggested by Shavit and Touitou [15] and a so called Dynamic STM (DSTM) for dynamic data structures which uses a contention manager as an independent module was proposed [7]. DSTM is a practical obstruction-free STM system that seeks a
This content is AI-processed based on open access ArXiv data.