
Dynamic concurrent insert(), remove() and find(), also the method succes- van Emde Boas array sor(), which allows users to determine the first greater element from the specified one. It has very good theo- retical and practical properties, as confirmed by tests Konrad Kułakowski and analyses carried out. Unfortunately, one of the shortcomings of that solution is the need to allocate AGH University of Science and Technology, all the required memory at the very beginning, as in al. Mickiewicza 30, Kraków, Poland, the case of a regular array. Another limitation of that [email protected] structure is the implementation of successor(), which in the case of massive interference with remove() op- erating in different threads might be delayed or failed Abstract. The growing popularity of due to the search repetition. These deficiencies led shared-memory multiprocessor machines the author to propose a new dynamic concurrent van has caused significant changes in the design Emde Boas (dcvEB) array, which, on the one hand, of concurrent software. In this approach, retains the good properties of its antecedent, and on the concurrently running threads commu- the other hand is deprived of its shortcomings. Hence, nicate and synchronize with each other the new structure presented in this article allocates through data structures in shared memory. and deallocates memory dynamically, depending on Hence, the efficiency of these structures is the amount of data stored in it. In addition, a new essential for the performance of concurrent applications. The need to find new concur- strategy for the successor() and predecessor() meth- rent data structures prompted the author ods has been adopted. The new structure, rather than some time ago to propose the cvEB array repeating the successor or predecessor search, contin- modeled on the van Emde Boas Tree struc- ues searching until an appropriate element is found ture as a dynamic set alternative. or the absence of such an element is decided. The as- This paper describes an improved version sumed strategy is more robust and less susceptible to of that structure - the dcvEB array (Dy- interference. It also seems to be more intuitive and namic Concurrent van Emde Boas Array). justifiable in the context of user expectation. One of the improvements involves memory The article consists of several sections, where, ex- usage optimization. This enhancement re- cept for introductory ones (Sec. 1 - 3), the dcvEB ar- quired the design of a tree which grows ray (Subsection 4.2) and its implementation (Subsec- and shrinks at both: the top (root) and the bottom (leaves) level. Another enhance- tion 4.3) are discussed. Next, the mechanisms of con- ment concerns the successor (and predeces- current expanding and shrinking are explained (Sub- sor) search strategy. The tests performed section 5.1). Other enhancements, such as dynamic seem to confirm the high performance of memory allocation and the new search strategy, are the dcvEB array. They are especially visi- explained (Subsections: 5.2 and 5.3). Then, the suc- ble when the range of keys is significantly cessor search running time and the structure correct- larger than the number of elements in the ness are discussed (Section 5). The experimental re- collection. sults are examined in Section 6. The comments and discussion (Section 7) and a brief summary (Section 1 Introduction 8) close the article. arXiv:1509.06948v1 [cs.DS] 23 Sep 2015 The rapid rise in the popularity of multi-core shared- 2 Background memory processor systems makes concurrent pro- grams increasingly common and desirable. Following A dynamic set is one of the basic data structures in the growing market for concurrent software, an in- computer science. Usually, it is assumed that a dy- creasing demand for the use of concurrent data struc- namic set supports the following operations: insert(), tures can be observed. Such a situation makes the delete(), search(), minimum(), maximum(), succes- search for new concurrent data structures particu- sor() and predecessor() [5, p. 230]. The first two of larly important. One of the attempts to find such a them are included in the category of modifying oper- structure is the work [15] in which the author pro- ations, while others are queries, which do not modify posed the early version of the concurrent van Emde the structure. Due to increasing demands for data Boas (cvEB) array. The structure presented here is format, different structures support dynamic set op- an example of concurrent dynamic set implementa- erations to varying degrees. In particular, good dy- tion providing, in addition to the standard methods namic set operation performance is provided by bal- anced search trees. For instance, all the dynamic set unusable if the stored objects cannot be represented operations can be handled by RB-Trees [1] in a se- as unique integers. quential running time O(lg α), whilst van Emde Boas The key to the efficiency of the vEB tree operations trees [25] need barely O(lg lg α) time to complete any is the uneven number of subtrees on different levels of the mentioned operations [5]. Unfortunately, tran- of the vEB tree. Thus, the root node has α1=2 of sub- sition from the sequential to the concurrent objects trees, whereas each next level of the vEB tree shrinks is not easy [24]. Hence, many concurrent dynamic set the number of children in the nodes by the square implementations (e.g. [6,13]) do not support all the root. Assuming that an operation over the vEB tree dynamic set operations and instead focus on dictio- performs O(1) work at each level of the hierarchy, nary operations. the running time of a method is O(h), where h is the The early works on the concurrent balanced search height of the vEB tree. Reducing the number of sub- trees with dictionary operations began to emerge in trees can not be carried out indefinitely. Thus, at the the 70s [23,2]. In the subsequent years, the topic was last but one level of the tree, the nodes have at most h−1 studied in [7,16,19]. The studies, initially focusing two single-element subtrees, i.e. α1=2 = 2. Hence, on lock strategy [2] and lock coupling [19,17], be- we obtain ln α = 2h−1, and finally h = ln ln α + 1. gan to deal with the relaxed (delayed) re-balancing Thus, the asymptotic running time of an exemplary [21,9] and the non-blocking synchronization schemes operation is O(ln ln α + 1) = O(ln ln α). [3,6,4,13]. To be able to traverse each level of a tree in O(1) Skip List, proposed by Pugh [22], is an alternative the vEB tree methods use the arrays of references to to balanced search trees. It provides several linked the subtrees. For this reason the root node Troot needs 1=2 lists arranged in a hierarchy, so that the single list to store Troot:arr - α -element array of subtrees, corresponds to the set of nodes at the same depth their children T , T:arr - α1=4-element arrays of their in a search tree. The structure avoids additional re- subtrees, and so on. With this construction, every balancing due to the randomized fashion of the in- method can calculate in which subtree the given key sertion algorithm. SkipList is suitable for both the can be found. For example, in the case of the root sequential and concurrent applications. Very efficient node, the key x is expected to be in x/α1=2 subtree SkipList implementation [10], based on Fraser [8], is etc. part of a standard Java API 5. The Java SkipList To achieve O(1) level traversing time, the more implementation as one of the few (the second is a complex methods like successor() and predecessor() SnapTree Map by Bronson [3]) supports all the dy- need further information about the subtrees. Thus, namic set operations including successor() and pre- with every node T the next three variables are as- decessor(). signed: T:max, T:min and T:summary, where T:max, T:min denote correspondingly the maximal and the minimal value of a key in the subtree rooted in T . 3 van Emde Boas tree The summary is an auxiliary search structure. Intu- itively speaking, the search() method traverses down The tree structure proposed by van Emde Boas [25] the vEB tree along a well-defined path from the root is not a typical search tree. It supports all the to the given key. The successor() must deviate from dynamic set operations, such as insert(), delete(), this path to the right (predecessor() to the left). The search(), minimum(), maximum(), successor() and decision whether to go down into the subtree accord- predecessor() [5, p. 230] in O(ln ln α). This tremen- ing to the predetermined path or go to the right at the dous speed involves the requirement that the keys same level is taken on the basis of the value T:max. must be unique integers in the range 0 to α − 1. Thus, if T is a subtree in which, according to the Thus, from a practical point of view, the van Emde path calculation, the key x should be stored, then Boas (vEB) tree is something between an array and the successor() goes down into T only if x < T:max, a search tree. Assuming that the number of stored i.e. when the maximal key in T is greater than x. elements is essentially smaller than α, the vEB tree If x ≥ T:max the successor() method needs to move is better than the array as regards the speed of suc- horizontally to the right in search of the first non- cessor(), predecessor(), minimum() and maximum().
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages18 Page
-
File Size-