Transactional Collection Classes.ppt
《Transactional Collection Classes.ppt》由会员分享,可在线阅读,更多相关《Transactional Collection Classes.ppt(27页珍藏版)》请在麦多课文档分享上搜索。
1、Transactional Collection Classes Brian D. CarlstromTransactional Collection ClassesBrian D. Carlstrom, Austen McDonald, Michael CarbinChristos Kozyrakis, Kunle OlukotunComputer Systems LaboratoryStanford Universityhttp:/tcc.stanford.eduTransactional Collection Classes 2Transactional MemoryPromise of
2、 Transactional Memory (TM) Make parallel programming easier Better performance through concurrent executionHow does TM make parallel programming easier? Program with large atomic regions Keep the performance of fine-grained lockingTransactional Collection Classes Transactional versions of Map, Sorte
3、dMap, Queue, Avoid unnecessary data dependency violations Provide scalability while allowing access to shared dataTransactional Collection Classes 3Evaluating Transactional MemoryPast evaluations Convert fine-grained locks to fine-grained transactions Convert barrier style applications with little c
4、ommunicationPast results TM can compete given similar programmer effortWhat happens when we use longer transactions?Transactional Collection Classes 4TM hash table micro-benchmark comparisonOld: Many short transactions that each do only one Map operationNew: Long transactions containing one or more
5、Map operationsTransactional Collection Classes 5New: High contention - All threads in 1 warehouse All transactions touch some shared MapTM SPECjbb2000 benchmark comparisonOld: Measures JVM scalability, but app rarely has communication 1 thread per warehouse, 1% inter-warehouse transactionsTransactio
6、nal Collection Classes 6Unwanted data dependencies limit scalingData structure bookkeeping causing serialization Frequent HashMap and TreeMap violations updating size and modification countsWith short transactions Enough parallelism from operations that do not conflict to make up for the ones that d
7、o conflictWith long transactions Too much lost work from conflicting operationsHow can we eliminate unwanted dependencies?Transactional Collection Classes 7Reducing unwanted dependenciesCustom hash table Dont need size or modCount? Build stripped down Map Disadvantage: Do not want to custom build da
8、ta structuresOpen-nested transactions Allows a child transaction to commit before parent Disadvantage: Lose transactional atomicitySegmented hash tables Use ConcurrentHashMap (or similar approaches) Compiler and Runtime Support for Efficient STM, Intel, PLDI 2006 Disadvantage: Reduces, but does not
9、eliminate, unnecessary violationsIs this reduction of violations good enough?Transactional Collection Classes 8Composing Map operationsSuppose we want to perform two Map operations atomically With locks: take a lock on Map and hold it for duration With transactions: one big atomic block Both lousy p
10、erformance Use ConcurrentHashMap? Wont help lock version Probabilistic approach hurts as number of operations per transaction increasesCan we do better?Example compound operation:atomic int balance = map.get(acct);balance += deposit;map.put(acct, balance);Transactional Collection Classes 9Semantic C
11、oncurrency ControlDatabase concept of multi-level transactions Release low-level locks on data after acquiring higher-level locks on semantic concepts such as keys and sizeExample Before releasing lock on B-tree node containing key 7record dependency on key 7 in lock table B-tree locks prevent races
12、 lock table provides isolation421 3 5 76TX# Key Mode #23177 Read Transactional Collection Classes 10Semantic Concurrency ControlApplying Semantic Concurrency Control to TM Avoid retaining memory level dependencies Replace with semantic dependencies Add conflict detection on semantic propertiesTransa
13、ctional Collection Classes Avoid memory level dependencies on size field, Replace with semantic dependencies on keys, size, Only detect semantic conflicts that are necessaryNo more memory conflicts on implementation details Transactional Collection Classes 11Transactional Collection ClassesOur gener
14、al approach Read operations acquire semantic dependency Open nesting used to read class state Writes buffered until commit Check for semantic conflicts on commit Release dependencies on commit and abortSimplified Map example Read operations add dependencies on keys Write operations buffer inserts an
15、d updates On commit we applied buffered changes, violating transactions that read values from keys that are changing On commit and abort we remove dependencies on the keys we have readTransactional Collection Classes 12c = 23c = 23c = 1size=4a = 50,b = 17,c = 23,d = 42size=2b = 17d = 42d = 2c = 1,d
16、= 23c = 23Example of non-conflicting put operationsUnderlying MapWrite BufferDepend-enciesput(c,23) open-nested transactionWrite Bufferput(d,42) open-nested transactionTX #2 startingTX #1 startingTX #1 commit and handler executionTX #2 commit and handler executionTransactional Collection Classes 13c
17、 = 1c = 1,2size=3a = 50,b = 17,c = 23c = 23c = 23size=2b = 17Example of conflicting put and get operationsUnderlying MapWrite BufferDepend-enciesput(c,23) open-nested transactionWrite Bufferget(c) open-nested transactionTX #2 startingTX #1 startingTX #1 commit and handler executionTX #2 abort and ha
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- TRANSACTIONALCOLLECTIONCLASSESPPT
