Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Empirical Evaluation of Extendible Arrays Stelios Joannou & Rajeev Raman University of Leicester 7 May 2011 10th International Symposium on Experimental.

Similar presentations


Presentation on theme: "An Empirical Evaluation of Extendible Arrays Stelios Joannou & Rajeev Raman University of Leicester 7 May 2011 10th International Symposium on Experimental."— Presentation transcript:

1 An Empirical Evaluation of Extendible Arrays Stelios Joannou & Rajeev Raman University of Leicester 7 May 2011 10th International Symposium on Experimental Algorithms

2 Introduction There is increasing use of in-memory RAM dynamic data structures (DS) to store large dynamic data sets. eg.: succinct DS, bloom filters and hash tables Unlike traditional (pointer-based) dynamic DS, RAM DS can allocate/free variable-sized chunks of memory memory fragmentation! 27 May 2011 10th International Symposium on Experimental Algorithms

3 Does Fragmentation Matter? Many recent computers have VM with 64-bit address space = 16 exabytes of addressable memory, but: – Many 32-bit machines still around – Java VM has 2GB limit – Some OS have no VM (Android VM) – Fragmentation can lead to thrashing, even when allocated memory is clearly less than available physical memory. Many studies regarding fragmentation (from [B. Randell. Comm. ACM69] to [Brodal et al. Acta Inf.05]) in general but not about specific DS. 37 May 2011 10th International Symposium on Experimental Algorithms

4 Introduction Explicit memory management for dynamic DS is infeasible in practice: –Use fragmentation-friendly DS We consider the extendible array (EA) and collection of EAs (CEA). –CEAs can be used to construct complex DS [eg Raman/Rao ICALP03] Aim of this paper: study implementations for CEA from fragmentation perspective. 47 May 2011 10th International Symposium on Experimental Algorithms

5 EAs and CEAs Dynamic arrays that can grow/shrink from one side: –grow/shrink () –access (i) CEA (collection of EAs) similar to EA: –create () –destroy (A) –access (i, A) –grow/shrink (A) 57 May 2011 10th International Symposium on Experimental Algorithms

6 Vector EA Included in the C++ STL Data stored in an array When array full, do doubling – Create a new array of double the size – Copy everything to the new array, delete old array Advantages – Access time is worst case O (1) – Grow/Shrink takes O (1) amortized time Disadvantages – It can have internal fragmentation of Θ (n) words 67 May 2011 10th International Symposium on Experimental Algorithms

7 Simple EA Uses constant size of DB, double IB when full DB and IB size are a power of 2 Index Block (IB) keeps track of DBs Data Blocks(DB) contain data 77 May 2011 10th International Symposium on Experimental Algorithms

8 Advantage – access: O(1) worst-case time. – grow/shrink: O(1) amortized time. – most memory is allocated/freed in fixed-size blocks, so reduced external fragmentation when used in CEA (fragmentation-friendly). Disadvantages – A small DB size will lead to a huge IB – A big DB size may lead to internal fragmentation – optimal DB size may be data dependent! Simple EA 87 May 2011 10th International Symposium on Experimental Algorithms

9 Self-tuning Self-tuning DS choose main parameters automatically and automatically rearrange data accordingly. Simple is not self-tuning. We want EAs that are both fragmentation- friendly and self-tuning. 97 May 2011 10th International Symposium on Experimental Algorithms

10 Brodnik EA ([Brodnik et al. WADS '99]) Index Block (IB) keeps track of DBs 107 May 2011 10th International Symposium on Experimental Algorithms

11 Brodnik EA ([Brodnik et al. WADS '99]) 117 May 2011 10th International Symposium on Experimental Algorithms

12 Modified Brodnik EA Combines Brodnik and Simple DBs have equal size, DB and IB sizes are a power of 2 When growing: alternates doubling IB and DB 127 May 2011 10th International Symposium on Experimental Algorithms

13 Modified Brodnik EA 137 May 2011 10th International Symposium on Experimental Algorithms

14 Brodnik CEA Global Brodnik CEA 147 May 2011 10th International Symposium on Experimental Algorithms

15 Global Brodnik CEA 157 May 2011 10th International Symposium on Experimental Algorithms

16 Brodnik CEA Global Brodnik CEA 167 May 2011 10th International Symposium on Experimental Algorithms

17 Experimental Results Speed tests for different ratios of EAs/# of elements Sequential Access: – Vector is the fastest – Brodnik slowest Random Access: – Simple Slowest in first test – Vector is faster in 2 nd and 3 rd case (indirection) EAs x ElementsDSGrowSequentialRandom 16 x 16777216 Vector 2.380.2522.65 Brodnik 2.931.9028.66 Simple 1.870.3140.53 Modified Brodnik 1.690.2920.63 Global Brodnik 4.950.3323.96 16384 x 16384 Vector 1.900.2524.03 Brodnik 3.121.8757.46 Simple 1.850.3244.35 Modified Brodnik 2.390.3048.05 Global Brodnik 4.930.3444.46 2097152 x 128 Vector 3.120.2944.69 Brodnik 6.312.0986.45 Simple 2.110.4356.28 Modified Brodnik 6.210.5854.04 Global Brodnik 6.260.4858.26 177 May 2011 10th International Symposium on Experimental Algorithms

18 Experimental Results - 2 80-20 Test – 20% of DS contain 80% of total elements – Going through CEA, shrink an EA, grow a random one based on the rule – Keep doing that for times equal to the total number of elements DS InitialEnding VM (MB)RES (MB)VM (MB)RES (MB) Vector278266692603 Brodnik388377628523 Simple304293357343 Modified Brodnik 328318577485 Global Brodnik 328318372357 187 May 2011 10th International Symposium on Experimental Algorithms

19 Experimental Results - 3 Thrashing occurred in Brodnik, Mod. Brod and Vector EAs Simple, Global Brod. kept low memory usage so thrashing Results verified by examining CPU usage and page faults DS InitialFinal CPUElapsed VMRESVMRES Vector4.233.737.343.7440.12780 Brodnik3.663.656.063.7340.19872 Simple2.832.823.203.1728.20150 Modified Brodnik 3.153.145.713.6743.281988 Global Brodnik 3.153.143.513.4725.52134 197 May 2011 10th International Symposium on Experimental Algorithms

20 Conclusion 207 May 2011 10th International Symposium on Experimental Algorithms –Increase in importance of RAM DS makes fragmentation important, demonstrated e.g. that thrashing occurs even in simple DSs, even when memory allocated is well below physical memory. –Introduced and established self-tuning and fragmentation-friendliness as desirable features for dynamic RAM data structures. For CEAs: The standard solution (vector) is not efficient. Fragmentation-friendly and self-tuning DS seem good all-round performers. –Further testing in real-world applications is needed.


Download ppt "An Empirical Evaluation of Extendible Arrays Stelios Joannou & Rajeev Raman University of Leicester 7 May 2011 10th International Symposium on Experimental."

Similar presentations


Ads by Google