Full text
1 sdsd Abstract— Transactional Memory (TM) is a promising new technology that makes it possible to ease writing multithreaded applications. Many different TM implementations exist, unfortunately most of those TM systems are currently evaluated by using workloads that are (1) tightly coupled to the interface of a particular TM implementation, (2) are small and lack to capture the common concurrency problems that exist in real multi-threaded applications and also (3) fail to evaluate the overall behavior of the Transactional Memory system within the context of the computer system from micro-architectural level up to the programming language support. WormBench is parameterized workload designed from the ground up to evaluate Transactional Memory systems in terms of robustness and performance. Its goal is to provide a unified solution to the problems stated above (1, 2, 3). The critical sections in the code are marked with the atomic statements and thus proving a framework to test the compiler or language interpreter ability to translate them properly and efficiently into the appropriate TM system interface. Its design considers all the common synchronization problems that exist in TM multi-threaded applications. The overall behavior of WormBench can be changed by using run configurations which provide the ability to reproduce a runtime behavior observed in a typical multi-threaded application or a behavior that stresses a particular aspect of the TM system such as abort handling. In this paper, we analyze the transactional characteristics of WormBench by studying different run configurations and demonstrate how WormBench can be configured so that it has similar TM behavior with an existing transactional application from the STAMP TM application suite. I. INTRODUCTION HE emerging era of Chip-Multiprocessors (CMP) pushed the research community to seek for new techniques to make it easier for application and library developers to develop scalable and efficient multi-threaded applications. Transactional Memory (TM) is an optimistic concurrency control mechanism first proposed by Herlihy and Moss [1] that promises to provide a better solution for the existing concurrency control scenarios in the multi-threaded applications with shared global state. Its simple programmming language interface, abstracts away the complexity of writing multi-threaded applications. Instead of tracking each shared data and enforcing serial access by using locks, using atomic blocks, the programmer only identifies the code segments that must be executed atomically and leave the underlying infrastructure handle synchronization. Its nonblocking nature prevents lock induced deadlocks. Typical implementations aim to scale comparably with fine grain lockings. Based on the implementation, TM exists in two flavors – Hardware (HTM) [3][4][5] and Software (STM) [6][7][8][9][10]. HTM is implemented at the microarchitectural level, it is fast but limited in time and space. STM is implemented as a runtime library, it is unbounded both in time and space but because of the incurred overhead is slow. Also, there exist hybrid solutions that either try to virtualize HTMs [2][22] or accelerate STMs [11][23][24]. Typically, the performance characteristics of the currently proposed TM systems are evaluated by using a small number of workloads. Mainly these are small application kernels – µbenchmarks. Recently, more complex TM applications were developed for benchmarking by either transactifying from lock-based versions (STMBench7 [12][13], applications from the SPLASH-2 benchmark suite [14]) or by writing TM applications from scratch (STAMP [11] 1 and Haskell STM benchmark suite [15]). The µbenchmarks perform simple type of operations such as lookup, insertion and deletion, on simple data structures like a linked list and hash tables. They are suitable for evaluating specific lowlevel implementation details of the TM systems, but they are not suitable to evaluate how the proposed TM system fits with the other components in the system. The transactional applications are more descriptive compared to the µbenchmarks as they perform computations in and outside the transactions. STAMP has long running transactions with small objects and is targeted for evaluating both HTM and STM. STMBench7 has long running transactions with large objects and is designed for evaluating STM systems. SPLASH-2 has inherently parallel code with small critical sections that guard small objects. It has been used to evaluate the following HTM systems [2][3][4]. Haskell STM benchmark is set of applications implemented using the language level constructs in the Haskell programming language and do not expose any implementation details of the underlying STM system. The other discussed TM applications are implemented by exposing the implementation details of the TM system that they are targeted for. This makes it difficult to compare different TM systems as porting the applications to every different TM interface requires significant effort. STAMP does not provide lock based implementation for comparison purposes and is implemented with precise knowledge about the shared data and when it is concurrently accessed. This approach assumes a perfect compiler that can filter every shared variable from non-shared, which is not the likely case. STMBench7 cannot be used for HTM as it has mainly large data structures and long running transactions. SPLASH-2 is suitable to underline the performance of HTM only as it has mostly short transactions with small read/write sets that can fit in the hardware caches. But the 1 Except Kmeans which is transactified from a lock-based version from NU-MineBench applications suite. Ferad Zyulkyarov, Sanja Cvijic, Osman Unsal, Adrian Cristal, Eduard Ayguade, Tim Harris, Mateo Valero WormBench – Technical Report T
2 short transactions in SPLASH-2 would incur significant overhead in STMs that cannot be amortized. In this paper we present WormBench – a configurable/customizable TM workload written in C#, designed from the ground up to evaluate and verify the correctness of TM systems. The design approach of WormBench is driven by the problem of how to evaluate the TM system as another tool (like locks) for providing synchronization in multi-threaded applications. All the concurrency control mechanisms like locks, message passing and also transactions exists as means for efficiently solving the synchronization problems in parallel applications. Probably if we didn’t have these synchronization problems such as concurrent access to a shared data, we would not need concurrency control at all. WormBench’s implementation does not depend on a particular STM or HTM interface and the critical sections in the code are expressed in terms of the language-level atomic blocks. It assumes that the compiler or runtime system translates these into the appropriate concurrency control operations on a TM implementation. This way it can be used also to test the effectiveness of optimizations performed by TM-enabled compilers which are just starting to appear in the horizon [20][21] – something which has been neglected so far 2 . WormBench is highly configurable and can be configured to reproduce a certain runtime behavior that might be general enough and represent a typical multi-threaded application or specific that stresses a particular aspect of the TM system such as dealing with overflowing transactions. The idea of WormBench is inspired by the popular Snake game (see Figure 1). In the application several Worms, each driven by a dedicated thread moves within a shared environment – BenchWorld (abstraction of a matrix). Each move consists of several critical operations accompanied by computation. Worms can be grouped so that they recreate complex synchronization scenarios where multiple threads are involved. By changing the parameters of the applications such as the type of performed computation, the size of the BenchWorld and the Worm, one can devise a different run configuration which has different transactional and runtime characteristics. In this paper we describe the characteristics of every operation that a worm may apply and later analyze them altogether by studying 40 different run-configurations. Then we demonstrate by example how WormBench can be configured to exhibit almost the same transactional behavior that the genome application from STAMP benchmark has. Thus, WormBench is able to mimic different existing TM applications through reconfigurations. The goal of WormBench is to help TM researchers easily create transactional workloads that they can use to verify and evaluate the efficiency of their TM systems and the compiler infrastructure that sits between the programming language and the TM. Using WormBench, one can develop a set of representative run configurations that has the transactional behavior of a typical multi-threaded application. Then use these run configurations as a baseline to compare different 2 Except Haskell STM benchmark which is implemented with the language level constructs existing in Haskell. TM systems among each other and against the lock based version. Also, as being general enough, WormBench can be configured as a workload to stress a low level implementation detail in the TM system such as frequent read set overflows. The rest of the paper follows with the requirements section where we discuss the issues that drive the design of WormBench. After that we describe the design and implementation of WormBench with greater details in Section III. In Section IV, we present and analyze a set of different run configurations that show how the transactional characteristics changes based on the different parameters. In Section V we give an example run configuration that has very similar transactional characteristics to the genome application in STAMP. In Section VI we discuss the related research. Conclusion follows in Section IV and we finish by discussing the open issues in section Future Work. II. REQUIREMENTS Because Transactional Memory is about concurrency control, the main requirements for a representative Transactional Memory workload should include the common synchronization problems that exist in multithreaded applications. In this way, we would be able to see how a given synchronization problem is solved by conceptually different techniques – locks which are blocking versus transactions which are non-blocking and compare them against each other. And also, to be able to compare different Transactional Memory systems, it is required that a representative workload should consider the essential features of the Transactional Memory system. This section discusses the synchronization problems and the TM relevant metrics that should be considered when building a representative workload or a suit of workloads to evaluate Transactional Memory systems. A. Synchronization Problems The necessity of having concurrency control is because of the common synchronization problems that exist in multi threaded applications. The typical synchronization problems that can be seen in these applications and that a Fig . 1. A screenshot from WormBench. In WormBench we refer to the snakes as worms.
3 representative synthetic TM workload should have an instance of, are: • Object access serializability [16] – managing a concurrent access to a shared data. This is the typical scenario when we guard the access of a shared variable by lock; • Barrier synchronization – making group of threads to wait at certain point of execution until all (or group) of them arrive there; • Two phase locking and its derivatives [17] – a locking protocol which attempts to provide the efficiency of fine grain locking and avoiding deadlock 3 by enforcing a given pattern; • Dining philosophers [18] – is a synchronization problem that demonstrates the deadlock problem; • Multiple granularity locking [19] – a fine grain locking technique used to lock a region in a hierarchical data structures like trees; B. Metrics To be able to compare different TM system between each other and also TM systems against lock based implementations, a representative workload application should clearly identify a set of metrics that can be used to quantitatively evaluate the performance of different TM systems. These metrics should source from the application and not be specific to a particular design or implementation style of any TM system (HTM or STM). Based on the metrics used in the existing TM research, we decided to collect the following runtime metrics in an application: • Execution time of the application; • Number of entered critical sections (i.e. atomic blocks, omp critical for future OpenMP or other platforms); • The ratio between reads and writes (e.g. 90% reads and 10% writes); • Size of the accessed data structures; • The execution time spent while in a critical section (short transactions vs. long transactions); • Number of successfully committed transactions; • Number of reads and writes per transaction; 3 In the simple two phase locking deadlock still can occur. • Prevalent type of operations in the application (I/O, CPU, memory); and • Locality of memory references (spatial vs. temporal). III. WORMBENCH DESIGN AND IMPLEMENTATION The idea for WormBench is inspired from the Snake game (see Figure 1). The application has two main data structures – BenchWorld and Worm. In the application, several Worms move in the BenchWorld and execute worm operations from an user specified stream (see Figure 2). Each cell in BenchWorld is a BenchWorldode struct which packs several data: (1) a value of the node, (2) the reference to the worm that is on this cell, (3) a reference to the group to which the worm on this cell belongs to, (4) and a message for the next worm that will pass from this cell. Worms are active objects meaning that every Worm object is associated with one thread. A Worm object has several attributes: id, group, speed, body, and head. Id is a unique identifier to distinguish the worm from the other worms, group is a reference to a Group object that groups several worm objects together. The rationale behind the notion of group is to be able to create synchronization scenarios where several worms act together to achieve a common task. The speed attribute is used to tell how fast the worm to advance (e.g. 1 cell per move). The body of the worm is the set of the cells from the BenchWorld where the worm steps on. The head of the worm represents a set of nodes from the BenchWorld that the worm uses as input to every worm operation, and the result of the performed computation is stored in a private buffer for verification purposes. Worms are initialized with a stream of worm operations (see Figure 2-a) that they should perform on every move. Every move is completed in three steps: (1) read the cells below the head, (2) perform a worm operation on the head values, (3) and move its body forward. Each of these three steps involves a critical operation and is either synchronized with an atomic block (TM system) or with a global lock (preset at compile time). Reading the values below the head of the worm involves computing the worm orientation and the head coordinates. When the head values are read, the next worm operation from the operations stream is applied to these head values and the produced result is stored in a private buffer for verification purposes. When it’s time to advance forward, the worm updates the group field of every node constituting its body. In the transactional version of the benchmark this is a conditional atomic block which ensures that worms belonging to other groups cannot cross through each other. Every attempt of crossing would result in aborting the attacker transaction and blocking until the other worm moves its body out of the occupied node. The currently implemented worm operations that worms apply in step (2) are: 1) sum – sum all the values under the head; this operation is a basic computation and does not update the BenchWorld;
2) average – computes the average value of the cells under the worm’s head; this operation is a basic computation and does not update the BenchWorld; 3) median – computes the median value among the cells under the worm’s he ad; this operation where values are first sorted and then median is found; 4) min – finds the minimum value among the cells under the worm’s head; a basic search operation 5) max – finds the maximum value among the cells under the worm’s head; basic search opertion 6) replace max with avg – finds the maximum value and updates it with the average value; this operations is a combination between max and average operations. It involves a basic search and computation (only one node is updated) 7) replace min with avg – finds the minimum value and updates it with the average value; this operations is a combination between min and average operations. It involves a basic search and computation; 8) replace median with avg – finds the median value and updates it with t he average value; this operations is a combination between median and average operations. It involves a little bit more complex search and computation; 9) replace median with min – finds the median and the minimum value from the worm’s head and replaces; thi s operation is a combination between median and min operations and also involves a small updated to BenchWorld updated); 10) replace median with max – finds the median and the maximum value from the worm’s head and replaces; this operation is a combination between median and max operations and also involves a small updated to BenchWorld; 11) replace max and min – replace the maximum and minimum in the head and write the changes to the BenchWorld so that they are globally visible; 12) sort – sort the val ues under the head and write the result to the BenchWorld; this operations involves a significant atomic update on the BenchWorld; computes the average value of the cells under the worm’s head; this operation is a basic computation and does not update the BenchWorld; computes the median value among the ad; this is a search first sorted and then finds the minimum value among the cells search operation ; finds the maximum value among the cells search opertion ; finds the maximum value and updates it with the average value; this operations is a combination between max and a basic search and (only one node is updated) ; finds the minimum value and updates it with the average value; this operations is a combination between min and a basic search and finds the median value he average value; this operations is a combination between median and average operations. It involves a little bit more finds the median and the minimum value from the worm’s head and s operation is a combination between median and min operations and also involves a (two nodes are finds the median and the maximum value from the worm’s head and combination between median and max operations and also involves a replace the maximum and minimum in the head and write the changes to the BenchWorld so that they are globally visible; ues under the head and write the result to the BenchWorld; this operations involves a significant atomic update on the BenchWorld; 13) transpose – transposes the values under the head and writes the transposition to the BenchWorld; like the sort operation, thi significant atomic update on the BenchWorld; 14) checkpoint – the worm persist (coordinates) within the BenchWorld to a file for later undo; this operation involves basic I/O; 15) undo – this operation returns the body to the last checkpoint if any; this operation involves a basic I/O; 16) leave message – leaves a message on a node to be read by the other worms; the rationale behind introducing this operations is allowing complicated interactions between the wor instantiating the different synchronization problems described in Requirements section. The currently supported message is “goto node” that can be valid for a specific worm, for a group of worms or for all worms. When the “goto node” messag the intended recipient worm, it destination by following the shortest path and continuously applying worm move 4 . The transactional characteristics of these operations are given in Table I and Table II. Both, Ta show respectively how the change on the Worm’s body length and the head size affect the transactions’ read (R) and write (W) set per each Worm operation. When the head size is constant and only the body length changes, the read set rema ins constant and the write set increases linearly other hand, when the body length is fixed to 1 and the head size changes, both the read and write sets are affected and 4 The behavior of this operation and messaging between worms is very complex and its analysis could be an independent research work. Therefore in the current paper we discuss and analyze the runtime characteristics of WormBench in isolation of this worm operation. 5 The exact rate of increase depends on the underlying TM system. In our case with every step the number of reads increases by 13. Id = 3 Group = 5 Body = [coordinates] BodyLength = 8 HeadSize = 4 Speed = 1 Operations: sum – ahead rep_max_min – right avg - ahead (a) (b) Fig. 2. The main components in the WormBench configuration; (b) the position of the worm before performing the operations in the run configuration; (c) position of the worm after performing the operations in (a). 4 transposes the values under the head and writes the transposition to the BenchWorld; like the sort operation, thi s operations involves a significant atomic update on the BenchWorld; the worm persist s its current location (coordinates) within the BenchWorld to a file for later undo; this operation involves basic I/O; this operation returns the body of the worm to the last checkpoint if any; this operation involves leaves a message on a node to be read by the other worms; the rationale behind introducing this operations is allowing complicated interactions between the wor ms and this way instantiating the different synchronization problems described in Requirements section. The currently supported message is “goto node” that can be valid for a specific worm, for a group of worms or for all worms. When the “goto node” messag e is read by the intended recipient worm, it heads to the destination by following the shortest path and worm operations on every The transactional characteristics of these operations are given in Table I and Table II. Both, Ta ble I and Table II, show respectively how the change on the Worm’s body length and the head size affect the transactions’ read (R) and write (W) set per each Worm operation. When the head size is constant and only the body length changes, the read set ins constant and the write set increases linearly 5 . On the other hand, when the body length is fixed to 1 and the head size changes, both the read and write sets are affected and The behavior of this operation and messaging between worms is very complex and its analysis could be an independent research work. Therefore in the current paper we discuss and analyze the runtime and TM characteristics of WormBench in isolation of this worm operation. The exact rate of increase depends on the underlying TM system. In our case with every step the number of reads increases by 13. (c) The main components in the WormBench application. (a) run the position of the worm before performing the operations in the run configuration; (c) position of the worm after
5 the read set increases super-linearly 6 . Any combination of these operations with the body length and head size of the worms could give theoretically infinite number of TM specific runtime configurations. Table III summarizes the execution distribution of the Worm operations for 4 different body length and head size setups ran over 800.000 moves. The first column is the worm operation, the second column is the execution distribution when the body length and head sizes are 1-1 (B[1.1] means body length is 1, H[1.1] means the head size is 1), the third column is for worms with body length and head size of 4-4, the fourth column is when the body length and head size is 8-8 and the fifth is when the body length and head size is randomly selected in range [1.8]. Also, the increase in the head size is reverse-proportional to the WormBench throughput (execution time). Meaning that, by increasing the head size we can obtain longer transactions suitable to test STMs and by decreasing the head size we can obtain shorter transactions suitable to test HTMs. The relationship between the head size and the throughput can be seen in Figure 4 and Figure 5 discussed in more details in Section IV. When WormBench starts, it is initialized with a run configuration provided as input by the user. The run configuration defines: (1) the size of the BenchWorld (the size of the underlying matrix) and its initialization, (2) a common stream of worm operations; (3) the number of worms to create; (4) and for each worm: id, group id, body size and the location of the body on the BenchWorld, head size, speed, and a range from a common stream of worm operations that the worm has to perform on every move. By utilizing the summarized information in Table I, Table II and Table III, we can directly control the read set, write set and the conflict rate. Also, assigning each worm a specific stream of operations to perform, we can coarsely 6 The super-linear increase in the read set is because the number of nodesbelow the head is n 2 proportional. control the conflict rate between the transactions. For example, a stream of operations that leads all worms in a common point within the BenchWorld would result into a large number of aborts. Further, by properly using the messaging and the group notion, we can recreate instances of the synchronization problems described in Requirements section. At the end, when the execution completes, we perform an automatic correctness test (i.e. sanity check for the TM system). To verify that the TM system worked properly, we compare the sum of the matrix at the end of the execution with the sum of the matrix that was at the initialization. When computing the sum of the matrix at the end of execution we also account for the modifications done by the replace with average operations. These modifications are stored in worms’ private buffers. WormBench is implemented in C# language by applying the concepts of object oriented programming and is compact (940 lines of code). The code is implemented with two types of synchronizations – transactions (atomic blocks) and global lock. The synchronization type can be selected at compile time. The average sizes of the shared objects is 70 bytes and have several fields which makes it favorable for TM systems that perform the versioning in object granularity (mostly STM), cache line and word granularity (mostly HTM). The primary performance evaluation metric in the BenchWorld application is the throughput – the total number of moves per unit time. In behavior and synchronization, WormBench resembles the typical multi-threaded applications where independent threads perform memory reads, do computation and update a given global state. An example could be a web server with dynamic content rendering. Where the requests of the clients are served by different threads as the memory is searched for cached pages and updated on the fly depending on the provided input by the client. TABLE I R EAD AND W RITE S ET C HARACTERISTICS – H EAD S IZE F IXED Op 1 2 4 8 R W R W R W R W 1 11 3 11 4 11 6 11 10 2 11 3 11 4 11 6 11 10 3 11 3 11 4 11 6 11 10 4 11 3 11 4 11 6 11 10 5 11 3 11 4 11 6 11 10 6 14 4 14 5 14 7 14 11 7 14 4 14 5 14 7 14 11 8 14 4 14 5 14 7 14 11 9 14 4 14 5 14 7 14 11 10 14 4 14 5 14 7 14 11 11 14 4 14 5 14 7 14 11 12 16 4 16 5 16 7 16 11 13 16 4 16 5 16 7 16 11 14 11 3 11 4 11 6 11 11 15 11 3 11 4 11 6 11 11 The read (R) and write (W) set characteristics of worm operations when the head size is fixed to 1 and the body length 1, 2, 4 and 8. The read set in this case is constant and the change of the body length can be used to change the write set in a particular run configuration. TABLE II R EAD AND W RITE S ET C HARACTERISTICS – B ODY L ENGTH F IXED Op 1 2 4 8 R W R W R W R W 1 11 3 14 3 26 3 74 3 2 11 3 14 3 26 3 74 3 3 11 3 14 3 26 3 74 3 4 11 3 14 3 26 3 74 3 5 11 3 14 3 26 3 74 3 6 14 4 17 4 29 4 77 4 7 14 4 17 4 29 4 77 4 8 14 4 17 4 29 4 77 4 9 14 4 17 5 29 5 77 5 10 14 4 17 5 29 5 77 5 11 14 4 17 5 29 5 77 5 12 16 4 19 7 31 19 79 67 13 16 4 19 7 31 19 79 67 14 11 3 14 3 26 3 74 3 15 11 3 14 3 26 3 74 3 The read (R) and write (W) set characteristics of worm operations when the head size is fixed to 1 and the body length 1, 2, 4 and 8. The change of the body length can be used to change the write set in a particular run configuration.
To sum up , WormBench is highly configurable. By prepa ring different run configuration, its runtime and transactional characteristics may by easily tuned to match those of real multi-threaded applications , as will also be shown in Section V . Also, depending on the particular run configuration, transactions can be short and have small read and write set which will make it more favorable to HTMs. A run configuration with large transactions that have big read and write set would be more favorable to with different body length and head size may be sui hybrid solutions that either virtualizes HTMs or accelerate STMs. IV. ANALYZING WORMB ENCH The overall behavior of the WormBench application depends on the run configuration passed as input The runtime characteristics of the application c by tuning any of the following parameters: • Size of the BenchWorld; • Number of worms (number of threads) • Body length of each worm; • Head size of each worm; • The number and type of worm operations worm has to perform while moving • Synchronization type – atomic, lock. Altering any of these configuration parameters, prepare a run configuration to reproduce runtime behavior that might be general enough and represent a typical multi threaded application or specific that stresses aspect of the TM system such as many aborting transactions. TABLE III E XECUTION T IME D ISTRIBUTION OF W ORM O Op B[1.1]H[1.1] B[4.4]H[4.4] B[8.8] H[8.8] 1 0.42 0.433 0.194 2 0.42 0.278 0.324 3 0.839 3.649 9 .354 4 0.315 0.588 0.278 5 0.42 0.588 0.33 6 1.364 0.711 0.427 7 0.735 0.742 0.537 8 2.518 4.793 11.412 9 2.099 0.588 0.634 10 2.728 5.009 11.186 11 2.518 5.257 11.387 12 1.679 6.586 11.257 13 1.154 3.247 2.369 14 1.12 1.45 1. 982 15 1.06 1.32 1.85 Total 19.389 35.239 63.521 The execution time distribution by w orm operations excluded initialization (in percent) . Four different setups are ana different body length and head size values. The first three the body length and head size has equal values 1, 4 and 8. The 4th column the values are randomly picked in the range [1, 8]. , WormBench is highly configurable. By ring different run configuration, its runtime and transactional characteristics may by easily tuned to match , as will also be . Also, depending on the particular run be short and have small read and write set which will make it more favorable to HTMs. A run configuration with large transactions that have big read to STMs. Worms with different body length and head size may be sui table for hybrid solutions that either virtualizes HTMs or accelerate ENCH The overall behavior of the WormBench application depends on the run configuration passed as input by the user. The runtime characteristics of the application c an be altered (number of threads) ; worm operations that each while moving ; and atomic, lock. any of these configuration parameters, we can prepare a run configuration to reproduce runtime behavior that might be general enough and represent a typical multi - threaded application or specific that stresses a particular aspect of the TM system such as many aborting transactions. In this section we present several run configurations the purpose of studying the relationship between the configuration parameters and the behavior of WormBench We also compar e the obtained results in the transactional version of WormBench with the lock based version. A. Experimental settings We performed all measurements on a Dell PE6850 workstation with 4 dual-core x64 Intel Xeon 32KB IL1 and 32KB DL1 private per between the two cores on-die, 8MB L3 cores, and 32GB RAM . During our experiments threading was enabled, thus having operating system is Windows Server 2003 SP2 processor scheduling and the memory management policies were adjusted to favor foreground applications instead of background services. To compile the WormBench source code we used Bartok compiler [20] . compiler and managed runt ime system for the Common Intermediate Language. It has compiler level and runtime support for STM. The STM runtim version management, lazy conflict detection not visible among the threads. The memory management in WormBen ch is performed by a two garbage collector. We ran the executables with the system’s default normal process priority without tweaking with the CPU affinity. B. Description of the Run Configurations In our experiments we used a sin move operations. Both the operation type and the direction to move to were randomly generated with uniform distribution of the described worm operations (without leave message operation) and the three directions (ahead, left, right). To analyze the impact of the Benchworld size we used 4 different BenchWorlds with 128x128, 256x256, 512x512, and 1024x1024 sizes. To analyze how the worm’s body length and head size affect the execution we used four different (body length, head size) confi worms have body length and head size 1 (indicated as B[1.1]H[1.1]), all the worms have body length and head size 4 (B[4.4]H[4.4]), all the worms have body length 8 and head size 8 (B[8.8]H[8.8]), and all the worms have both body length and head size randomly generated in range [1, 8] (B[1.8]H[1.8]). Also, we prepared four different initia lizations for the worms based on the underlying BenchWorld size – 128x128, 256x256, 512x512, 1024x1024. To see how the worms initialization affect the execution, we run worms initialized for smaller BenchWorld in larger BenchWorld. For example, we ran worms initialized for 128x128 (a) (b) Fig. 3. Using worms ini tialized for small BenchWorld in a large BenchWorld. (a) using worms initialized for 128x128 in 1024x2024; (b) using worms initialized for 256x256 in 1024x2024; (c) using worms initialized for 512x512 in 1024x2024; (d) using worms initialized for 1024x2024 in 1024x2024. O PERATIONS H[8.8] B[1.8]H[1.8] 0.194 0.31 0.324 0.434 .354 5.14 0.278 0.372 0.33 0.537 0.427 0.743 0.537 0.702 11.412 6.689 0.634 0.929 11.186 7.06 11.387 7.122 11.257 7.184 2.369 3.365 982 1.522 1.85 1.488 63.521 42.597 orm operations from the total time . Four different setups are ana lyzed with different body length and head size values. The first three the body length and head size has equal values 1, 4 and 8. The 4th column the values are 6 In this section we present several run configurations with the relationship between the configuration parameters and the behavior of WormBench . e the obtained results in the transactional version of WormBench with the lock based version. We performed all measurements on a Dell PE6850 x64 Intel Xeon processors with private per -core, 4MB L2 shared 8MB L3 shared between all . During our experiments hyperthreading was enabled, thus having 16 logical CPUs. The operating system is Windows Server 2003 SP2 . The the memory management policies were adjusted to favor foreground applications instead of To compile the WormBench source . Bartok is an optimizing ime system for the Common Intermediate Language. It has compiler level and runtime STM runtim e library does eager lazy conflict detection and reads are The memory management in ch is performed by a two -generation copying executables with the operating process priority without tweaking Description of the Run Configurations In our experiments we used a sin gle stream of 800.000 move operations. Both the operation type and the direction to move to were randomly generated with uniform distribution of the described worm operations (without leave message operation) and the three directions (ahead, left, To analyze the impact of the Benchworld size we used 4 different BenchWorlds with 128x128, 256x256, 512x512, and 1024x1024 sizes. To analyze how the worm’s body length and head size affect the execution we used four different (body length, head size) confi gurations – all the worms have body length and head size 1 (indicated as B[1.1]H[1.1]), all the worms have body length and head size 4 (B[4.4]H[4.4]), all the worms have body length 8 and head size 8 (B[8.8]H[8.8]), and all the worms have both body and head size randomly generated in range [1, 8] (B[1.8]H[1.8]). Also, we prepared four different initia - for the worms based on the underlying BenchWorld 128x128, 256x256, 512x512, 1024x1024. To see how execution, we run worms initialized for smaller BenchWorld in larger BenchWorld. For example, we ran worms initialized for 128x128 (c) (d) tialized for small BenchWorld in a large BenchWorld. (a) using worms initialized for 128x128 in 1024x2024; using worms initialized for 256x256 in 1024x2024; (c) using worms initialized for 512x512 in 1024x2024; (d) using worms initialized for
7 BenchWorld in a 1024x1024 BenchWorld. As shown on Figure 3, worms initialized for smaller BenchWorld are relatively closer to each other and likely to be source of frequent conflicts. Based on the synchronization – we prepared two different executables with transactions and global lock. We made all the possible combinations from the so far described different configurations 7 and ran with 1, 2, 4, 8 and 16 worms (threads). This resulted in total of 80 combinations with 400 independent runs. We repeated each of these runs 3 times and present the averaged results. C. Analysis of the Run Configurations Figure 4 shows how the throughput is affected by the different synchronizations, TM (atomic) and locks. From this figure we can conclude that although the atomic version of WormBench scales, its best performance with 16 worms (threads) is less than the lock based synchronization with 1thread. The reason for this is that the STM systems incur significant overheads when doing versioning of the accessed read and write set, especially on the case when the worms body and head is 8 (B[8.8]H[8.8]) and the transaction has big read and write set. Another issue that can be observed is that the performance of lock based version degrades when ran with more than 1 thread. The reason for this is that the Bartok runtime is optimized for the case when the “lock” operation targets a lock that is not held. If the “lock” operation finds that the runtime lock has been already set by an earlier compare-and-swap operation then an OS mutex is created and thread blocked. In our case WormBench uses global lock which is most likely acquired and this way reflected negatively to the total throughput. 7 We did not consider the combinations of running worms initialized for larger BenchWorld in a smaller BenchWorld. Figure 5 summarizes the relationship between the throughput (total number of moves per millisecond), the body length and head size, and the BenchWorld size. From the different charts (a), (b), (c) and (d) altogether is interesting to note here that the increase in the body length and head size have significant impact on the throughput. The obvious reason for this is that when the body length and head size becomes larger (especially head size, which has a O(n 2 ) impact) the input to the worm operations become larger and they spend more time doing computation. For example, in the case with a head size of 1 summing has only one node to add but in the case with head size of 8 has 64 nodes. Another reason is that when body length and head size increase, transactions become larger and their working set increases super linearly. The overhead for maintaining big read and write sets along with the increased probability for aborts becomes higher. This can be better seen in Figure 4-c with B[8.8]H[8.8], when the transactional version of WormBench always performs worse because of the overhead incurred by the versioning and frequent aborts. Figure 6 shows the ratio between the read and write set for the different worms’ sizes (body length and head size). The results are averaged accors the different sizes of the BenchWorlds. In the analyized run configurations, there are insignificant differences in the results between the different worms and mostly the reads are about 80% and wtrites are about 20%. Figure 7 shows the average number of the objects opened for read or write per transaction. The unfiltered read set and write set (denoted as UfR and UfW) represent all the objects to which the TM system attempted to access and the filtered read and write set (denoted as FR and FW) represents the actual number of objects versioned by the TM systems. For example, it may happen that one object or memory location is once versioned and later accessed again. In this case the Fig. 4. Comparing the performance between lock based synchronization and transactional memory synchronization (higher values are better). (a) all worms have body length and head size 1; (b) all worms have body length and head size 4; (c) all worms have body length and head size 8; (d) both the body length and head size of every worm is randomly selected from the range [1, 8]. Fig. 5. Relationship between throughput (total number moves per millisecond), BenchWorld size and the worm’s body length and head size (higher values are better). (a) all worms have body length and head size 1; (b) all worms have body length and head size 4; (c) all worms have body length and head size 8; (d) both the body length and head size of every worm is randomly selected from the range [1, 8].
8 TM system filters it and does not allocate an entry for the second access. In Figure 7 is interesting to see that although the unfiltered read and write set increases for the different sizes of the worms, the filtered set remains constant. Figure 8 shows the rate of successful commits (oposite to aborts). The commit rate in all the run configuration is very high. One reason for this is mainly bacuse of using big BenchWorlds. Based on the results in this graph, we can conclude our previous observation: since the commit rate is high, the primary factor affecting the performance of B[8.8]H[8.8] configuration is the versioning overhead. Figure 9 shows the commit rate results of run configuration with worms initialized for BenchWorld with size 128x128 and used in BenchWorlds with larger sizes (see Figure 3). The results in this figure are different from Figure 8 since its purpose is to show how the initialization of the worms affect the commit rate. The obtained results does not significantly differ from those in Figure 8 because we initialized the wroms with big worm operations streams. Consequently, this long execution has effectively decreased the impact of the conflicts occurred at the beginning of the execution when the worms were relatively closer to each other. This configuration can model a TM-execution which has phases: in the first phase it starts with a high conflict rate and continues with a lower conflict rate in the second phase. This charactewristic of WormBench could be very useful in testing how well adaptive TM systems perform in the presence of changes in runtime TM-application behavior. Based on the analyzed results in this section and the described characteristics of WormBench in the previous section, we will next show by example run configuration that WormBench can mimic the behaviour of genome application from STAMP. V. MODELING ANOTHER TM APPLICATION To demonstrate that WormBench is highly configurable we prepared a run configuration that has the similar transactional characteristics of the genome application from the STAMP benchmark. Table IV compares the TM and runtime characteristics of the genome (Gen.) application and Fig. 6. The ratio between the objects in the read set and writes set. Fig. 7. The number of unfiltered reads (UfR) and writes (UfW) per transaction and the number of filtered reads (FR) and writes (FW) per transaction. Fig. 8. The rate of successful commits out of all transactions. We omit the case for 1 worm (thread) because it is always 1. Fig. 9. The commit rate when worms are initialized for BenchWorld with size 128x128 and then used in larger BenchWorlds - 128x128, 256x256, 512x512 and 1024x1024.
9 the run configuration for WormBench (WB) that mimics genome. Read per TX is the reads and Write per TX is the Writes. The commit rate and the number of reads (R) is very similar to the original values in genome. The proposed run configuration scales up closely following the speedup rate of the original application. The number of writes (W) per transaction in WormBench is a little bit higher than in the original application but a careful tuning would be possible to lower writes and at the same time keep the other parameters unchanged. To obtain the results shown on Table IV we used the following run configuration: • Worms body length = 1 • Worms head size = 4 • BenchWorld of size 52x52 • Randomly generated stream of worm operations, where the ration between the worm operations was– Operations(1:2:3:4:5:6:7:8:9:10:11:12:13:14:15) = Ration(1:1:1:0:0:2:1:1:1:1:1:1:2:0:0) This is just a small example that demonstrates the high configurability of WormBench and how it can be used to reproduce the runtime and TM characteristics of a specific multi threaded application. VI. RELATED WORK Transactional Memory is new approach for providing concurrency control in multi-threaded applications. Because production implementation of TM systems are just appearing, there are very few TM applications. Some of these applications are small and perform simple operations such as lookup, insertion and deletion in basic data structures like linked lists, B+Tree and Hashtables. These applications are good for evaluating the TM system’s implementation details such as the size of the internal data structures or cashes. But not representative enough for evaluating the overall TM system benefits when memory accesses are associated with computations. STAMP [11] is a suite of applications that has been recently used for benchmarking Transactional Memory systems. The applications in STAMP are implemented from scratch considering transactions except kmeans which is transactified. The transactions in these applications are long with different TM characteristics such as read/write set size and commit rate. Their behavior can be changed depending on the input arguments but not with the high fidelity that WormBench provides. Also, STAMP applications are implemented by having precise knowledge about the shared data structures and the places where they can be accessed concurrently. Thus, only the access to these shared objects is wrapped by the TM system’s interface functions tm_write() and tm_read(). This, way of implementation ignores the likely compiler support for TM and assumes the perfect compiler that can filter all the shared variables from nonshared and handle them transactionaly. Though TM is intended to complement or replace the locks, STAMP does not provide any lock based implementation of the applications so that researches can compare the behavior of the TM system against the locks. The Haskell STM Benchmark suite [15] is a collection of 10 different applications. The suite has small, medium and large applications. It is implemented in the Haskell functional programming language. Haskell has language and compiler level support for transactional memory and the critical sections in the applications are implemented by using the language constructs. The benchmark can be used to evaluating range of TM aspects, including language and compiler support such as optimizations. Because the applications are implemented in declarative language and also depend on constraints enforced by the language and type system, rewriting them to an imperative language may not achieve the same evaluation effect as they have within the context of Haskell. STMBench7 [12] is an application designed for evaluating STM systems. It is transactified from the 007 benchmark. STMBench7 is implemented in both Java and C++ programming languages and also has lock based implementation in the both languages. In the Java version, the critical sections are marked with annotations. Although annotations are a mechanism for extending a language they don’t provide full integration with the language and the compiler components. In the C++ version, the critical sections are handled through explicit calls to the STM library interface by following a specific library usage pattern such as packing operations into transactional objects. This implementation approach makes the benchmark bound the interface and use of this particular STM library and difficult to port to other TM systems. The benchmark has big data structures and long running transactions. It makes it suitable for evaluating the TM system virtualization capability but not so suitable for evaluating HTM systems that has small caches (as its name implies). SPLASH-2 [14] is a suit of highly parallel applications, where threads spend most of their execution time in doing independent computations and the very short concurrent accesses to the shared data is synchronized by fine grain locking. Because of the high degree of parallelism this benchmark is suitable for evaluating the architectural aspects of different multi-processors but is in contrast with the intended use of transactions – like for coarse grain locking. TABLE IV T RANSACTIONAL C HARACTERISTICS OF G ENOME AND W ORM B ENCH T# Commit Rate R ead per TX W rite per TX Speedup Gen. WB Gen. WB Gen. WB Gen. WB 1 1 1 36.362 31.480 1.374 1.962 1 1 2 0.998 0.998 34.260 31.609 1.373 1.962 2.177 1.4 4 0.994 0.995 37.974 31.815 1.371 1.962 3.474 2.2 8 0.985 0.987 46.219 32.300 1.377 1.963 5.435 2.867 The transactional characteristics of genome application from STAMP and an instrumented run configuration for WormBench. Results obtained from WormBench are very similar to those obtained from genome.