Presentation is loading. Please wait.

Presentation is loading. Please wait.

Monitoring Data Structures Using Hardware Transactional Memory Shakeel Butt 1, Vinod Ganapathy 1, Arati Baliga 2 and Mihai Christodorescu 3 1 Rutgers University,

Similar presentations


Presentation on theme: "Monitoring Data Structures Using Hardware Transactional Memory Shakeel Butt 1, Vinod Ganapathy 1, Arati Baliga 2 and Mihai Christodorescu 3 1 Rutgers University,"— Presentation transcript:

1 Monitoring Data Structures Using Hardware Transactional Memory Shakeel Butt 1, Vinod Ganapathy 1, Arati Baliga 2 and Mihai Christodorescu 3 1 Rutgers University, 2 AT&T Security, 3 IBM Research

2 Data structure (DS) consistency Applications use data structures to store important information Data structures have consistency properties – e.g. circular linked list, balanced tree, sorted list 2 Inconsistent data structure can adversely affect the reliability and security of an application

3 Example: binary tree 3 Consistency constraint: parent(child(N)) = N N1N1 N1N1 N2N2 N2N2 N3N3 N3N3 N5N5 N5N5 N4N4 N4N4 N6N6 N6N6 N1N1 N1N1 N2N2 N2N2 N3N3 N3N3 N5N5 N5N5 N4N4 N4N4 M M N6N6 N6N6 M M insert

4 Example: linked lists Linux task list 4 task_list Consistency constraint: run_list is subset of task_list P1P1 P3P3 PnPn run_list P1P1 P3P3 PnPn P2P2 P2P2

5 DS monitoring infrastructure Low Overhead Can monitor complex data structure Extensible Applicable to low-level code 5

6 Naïve Solution Manually placing checks in code Problems – Infeasible for large software – High overhead – Keeping track of DS modifications 6

7 Our solution: TxMon Framework for online monitoring of data structures Uses hardware transactional memory (HTM) Features – Applicability to multi-threaded applications – Tolerable runtime overhead – No hardware modification 7 TxMon uses HTM to track data structure modifications

8 Outline Introduction TxMon TxMon API Hardware Transactional Memory TxMon Workflow Implementaion Results 8

9 Hardware transactional memory (HTM) Alternative to lock-based programming HTM provides atomicity and isolation HTM tracks all reads/writes 9 Acquire(S.lock) value = S.pop() Release(S.lock) transaction { value = S1.pop() }

10 Hardware transactional memory (HTM) Alternative to lock-based programming HTM provides atomicity and isolation HTM tracks all reads/writes 10 Acquire(S1.lock) Acquire(S2.lock) value = S1.pop() S2.push(value) Release(S2.lock) Release(S1.lock) transaction { value = S1.pop() S2.push(value) }

11 HTM internal mechanisms Conflict detection – read/write sets – cache based detection Version management – undo log 11

12 HTM workflow 12 Transaction Body Transaction Body Conflict Detection Conflict Detection Commit Logic Commit Logic Read/Write sets Abort Logic Abort Logic record accesses conflicting accesses retry no conflicts Undo log transaction completion

13 TxMon design 13 Transaction Body Transaction Body Conflict Detection Conflict Detection Commit Logic Commit Logic Read/Write sets Abort Logic Abort Logic record accesses conflicting accesses retry no conflicts Undo log transaction completion TxMon Monitor success failed check report violation No Changes to underlying HTM

14 Example: memcached Multithreaded key/value store Keeps 255 doubly linked lists 14 struct item { rel_time_t time; // last access time struct item *next, *prev; … } struct item *heads[255]; heads[i] item 1 item 2 item 3 item n void register_ds(void * ds, void * fp); Consistency constraint: heads[i] is sorted wrt time for(i = 0 ; i < 255 ; ++i) register_ds(&heads[i], check_sort);

15 Example: memcached 15 process_get_command (key) { struct item *it = search(key); if (it) { … it->time = curr_time; } … return it; } bool check_sort ( struct item * hd) { if( list not sorted wrt time) return false; return true; } transaction ( txmon_entry ) { }

16 TxMon implementation 16 Transaction {... tx_body... } Transaction {... tx_body... } Hardware Software Address mapsCallbacks Application TxMon’s data structure monitor TxMon is invoked at the end of transaction Use information from HTM to find modified data structures If checks satisfied, transfer control to HTM HTM

17 TxMon Implementation Address map Check Callbacks 17 txmon_entry (void) { accset = Get memory accesses from HTM for (addr in accset) for ( ds in registered data structures) if ( addr in address_map(ds) ) ret &= callback(ds) return ret; } bool check_sort ( struct item * hd) { // perform check // update address_map }

18 TxMon Internals Address map Check Callbacks 18 txmon_entry (void) { accset = Get memory accesses from HTM ds = Intersect(accset, address_map) callback(ds) } bool check_sort ( struct item * hd) { // perform check // update address_map }

19 TxMon implementation 19 Transaction {... tx_body... } Transaction {... tx_body... } Hardware Software Address mapsCallbacks Read/Write sets Application TxMon’s data structure monitor Space for undo logs Log for tx_body Log end Log begin TxMon is invoked at the end of transaction Taking intersection of Log and Address map to find modified data structures If checks satisfied, transfer control to HTM

20 Evaluation Goal of Evaluation: overhead of TxMon Two macro-benchmark (memcached, clamAV) Simics LogTM-SE is used as underlying HTM 20

21 Evaluation Goal of Evaluation: overhead of TxMon Two macro-benchmark (memcached, clamAV) Simics LogTM-SE is used as underlying HTM UltraSPARC-III-plus, 75MHz, 256 MB RAM 21

22 clamAV Single threaded anti-virus software. Workload: scan 356 files 22 VersionTime (sec) Unmodified (baseline)10.95 Ported to LogTM-SE (no TxMon)10.99 (1x) With TxMon enabled11.30 (1.03x)

23 memcached Distributed object caching server Workload: insert & query 100 key/value pairs 23 VersionOperations / sec Unmodified (baseline)7052 Ported to LogTM-SE (no TxMon)7066 (1x) With TxMon but without checks6615 (1.06x) With TxMon enabled5937 (1.18x)

24 Splash-2 24 BenchmarkTx-AddedTx-Executed Barnes3374 Radiosity44239,949 Raytrace1047,751

25 Splash-2 25 BenchmarkTx-AddedTx-Executed Barnes3374 Radiosity44239,949 Raytrace1047,751 Benchmark1248 Barnes7% 10%14% Radiosity11%18%17%20% Raytrace6% 7%6%

26 Conclusion TxMon – Monitors data structures using HTM – Does not require any changes in HTM – Can enforce arbitrary properties of data structures – Has reasonable overhead for online monitoring 26

27 Thanks Questions? 27


Download ppt "Monitoring Data Structures Using Hardware Transactional Memory Shakeel Butt 1, Vinod Ganapathy 1, Arati Baliga 2 and Mihai Christodorescu 3 1 Rutgers University,"

Similar presentations


Ads by Google