HICAMP: Architectural Support for Efficient Concurrency-Safe Shared Structured Data Access Cheriton et al., ASPLOS 2012 Yoongu Kim 11/18/2013 1
INTRODUCTION 2
Intro: Shared Data DRAM 4GB Thread 1 Private Shared Data Thread 2 Private 0GB 3
Intro: Shared Data DRAM 4GB Thread 1 Private a[999] ● ● ● shared array a[1] a[0] Thread 2 Private 0GB 4
Problem: Concurrent Accesses for (i=0; i<1000; i++) Thread 1 sum = sum + a[i] ; Read access to shared array CONFLICT! Write access to shared array a[900] = -1; Thread 2 5
Traditional Solutions are Expensive Solution #1: Lock – Only one thread can access shared data ... – ... the thread that holds the lock • But what if shared data is very large ? – Example: Bank database – When an auditing thread accesses the bank database, all other threads would starve • No deposits/withdrawals for any customer 6
Traditional Solutions are Expensive Solution #2: Transaction – Speculatively allow multiple threads to access shared data in a concurrent manner – If lucky � no conflict – If unlucky � undo changes to shared data & retry • But what if a transaction is very long ? – 100% chance of being unlucky – Undoing/retrying a transaction is wasteful 7
Throughput vs. Number of Cores Ideal Actual 48 Throughput 36 Gap 24 12 0 0 12 24 36 48 Number of Cores Sharing is the root of all evil 8
Gap before after expert hand-tuning Before and after before after Boyd-Wickizer et al., OSDI’10 before after before after before after before after 9
Alternative Solution: “Snapshotting” Thread 1 Shared Data Thread 2 10
Alternative Solution: “Snapshotting” Thread 1 Shared Data Thread 2 11
Alternative Solution: “Snapshotting” Thread 1 Shared Data Shared Data Thread 2 12
Alternative Solution: “Snapshotting” Thread 1 Shared Data Shared New Data Data Thread 2 13
Key Question How to make memory “snapshots” cheap? • Naïve approaches are very expensive 1. Performance waste: copying data 2. Capacity waste: duplicate data • A better approach: HICAMP – Provides hardware-support for “snapshots” while incurring only small overheads 14
HICAMP: THE BASICS 15
What is HICAMP? 1. H ierarchical 2. I mmutable 3. C ontent- A ddressable M emory 4. P rocessor 16
1. ‘H’ of HICAMP: “Hierarchical” 4GB Non-Hierarchical Data 3 Addr 3 Data 2 Addr 2 Data 1 Addr 1 0GB 17
1. ‘H’ of HICAMP: “Hierarchical” 4GB 4GB Non-Hierarchical Data 2 Hierarchical Data 1 Data 3 Addr 3 Data 2 Addr 2 Data 1 Addr 1 Data 3 0GB 0GB 18
1. ‘H’ of HICAMP: “Hierarchical” 4GB 4GB Non-Hierarchical Data 2 Hierarchical Data 1 Data 3 Addr 3 A 1 A 2 Data 2 Addr 2 Data 1 Addr 1 Data 3 0GB 0GB 19
1. ‘H’ of HICAMP: “Hierarchical” 4GB 4GB Non-Hierarchical Data 2 Hierarchical Data 1 Data 3 Addr 3 A 1 A 2 Data 2 Addr 4 Addr 2 Data 1 Addr 1 Data 3 0GB 0GB 20
1. ‘H’ of HICAMP: “Hierarchical” 4GB 4GB Non-Hierarchical Data 2 Hierarchical Data 1 Data 3 Addr 3 A 1 A 2 Data 2 Addr 4 Addr 2 Data 1 Addr 1 Data 3 A 4 A 3 0GB 0GB 21
1. ‘H’ of HICAMP: “Hierarchical” 4GB Non-Hierarchical A 4 A 3 Data 3 Addr 3 Data 2 A 1 A 2 Addr 2 Data 3 Data 1 Addr 1 Data 1 Data 2 0GB 22
1. ‘H’ of HICAMP: “Hierarchical” Root Addr: 4GB Non-Hierarchical Addr 5 A 4 A 3 Data 3 Addr 3 Data 2 A 1 A 2 Addr 2 Data 3 Data 1 Addr 1 Data 1 Data 2 0GB 23
What is HICAMP? 1. H ierarchical 2. I mmutable 3. C ontent- A ddressable M emory 4. P rocessor 24
2. ‘I’ of HICAMP: “Immutable” Overwriting of data is not allowed Addr 5 A 4 A 3 A 1 A 2 Data 10 Data 3 Data 1 Data 2 25
2. ‘I’ of HICAMP: “Immutable” You must create a new hierarchy Addr 5 Addr 11 A 4 A 3 A 4 A 10 new copy A 1 A 2 Data 3 Data 10 new copy Data 1 Data 2 26
2. ‘I’ of HICAMP: “Immutable” Old and new hierarchies coexist NEW OLD Addr 5 Addr 11 A 4 A 3 A 4 A 10 A 1 A 2 Data 3 Data 10 Data 1 DEDUPLICATION Data 2 27
What is HICAMP? 1. H ierarchical 2. I mmutable 3. C ontent- A ddressable M emory 4. P rocessor 28
3. “CAM” of HICAMP 4GB How to eliminate 0x123 Traditional duplicate values? 0x123 0x123 0x123 0GB 29
3. “CAM” of HICAMP • Q: Why do duplicates exist? • A: Because you can store the same value anywhere you want For a particular value, let’s restrict the addresses it can have 30
3. “CAM” of HICAMP Set of 64-byte values Set of addresses in 4GB DRAM 2 (64x8) ≈2 (32-6) f(x) elements Hash function 31
3. “CAM” of HICAMP DRAM 4GB ● ● ● ● ● ● ● ● ● ● ● ● RowN 64B 64B 64B ● ● ● ● ● ● ● ● ● ● ● ● Row3 64B 64B 64B ● ● ● ● ● ● ● ● ● ● ● ● Row2 64B 64B 64B ● ● ● ● ● ● ● ● ● ● ● ● Row1 64B 64B 64B 0GB Col1 Col2 ColM 32
3. “CAM” of HICAMP 64-byte Row data value Address 0x123 f(x) 77 ● ● ● ● ● ● ● ● ● ● ● ● Row 77 64B 64B 64B Column Address : 1‒M 33
3. “CAM” of HICAMP Data Value f(x) RowAddr ColAddr Data Address fixed flexible: to reduce hash conflicts 34
PROGRAMMING MODEL 35
Terminology “Root PLID” “Segment” A 4 A 3 “Physical Line” A 1 A 2 Data 3 “Physical Line ID” Data 1 Data 2 (PLID) 36
Virtual-to-Physical Translation “Virtual Segment ID” Software VSID Segment Map PLID Hardware A 4 A 3 A 4 A 10 A 1 A 2 Data 3 Data 10 Data 1 Data 2 37
Example Program /* it = iterator */ 1: it = obj.begin(); 2: it++; 3: it++; 4: *it = newVal; 5: it->tryCommit(); A 4 A 3 A 1 A 2 Data 3 Data 1 Data 2 38
Example Program /* it = iterator */ 1: it = obj.begin(); 2: it++; 3: it++; obj 4: *it = newVal; (VSID) 5: it->tryCommit(); A 4 A 3 it A 1 A 2 Data 3 begin( Data 1 Data 2 ) 39
Example Program /* it = iterator */ 1: it = obj.begin(); 2: it++; 3: it++; obj 4: *it = newVal; (VSID) 5: it->tryCommit(); A 4 A 3 it A 1 A 2 Data 3 Data 1 begin() Data 2 40
Example Program /* it = iterator */ 1: it = obj.begin(); 2: it++; 3: it++; obj 4: *it = newVal; (VSID) 5: it->tryCommit(); A 4 A 3 it A 1 A 2 Data 3 Data 1 begin() Data 2 41
Example Program /* it = iterator */ 1: it = obj.begin(); 2: it++; 3: it++; obj 4: *it = newVal; (VSID) 5: it->tryCommit(); A 4 A 3 copy A 4 A 10 it A 1 A 2 newVal Data 3 copy Data 1 begin() Data 2 42
Example Program /* it = iterator */ 1: it = obj.begin(); 2: it++; 3: it++; obj 4: it = newVal; (VSID) 5: it->tryCommit(); A 4 A 3 copy A 4 A 10 it A 1 A 2 newVal Data 3 copy Data 1 begin() Data 2 43
Recommend
More recommend