Fine-grained adaptive biased locking

F. Pizlo, Daniel Frampton, Antony Lloyd Hosking
{"title":"Fine-grained adaptive biased locking","authors":"F. Pizlo, Daniel Frampton, Antony Lloyd Hosking","doi":"10.1145/2093157.2093184","DOIUrl":null,"url":null,"abstract":"Mutual-exclusion locking is the prevailing technique for protecting shared resources in concurrent programs. Fine-grained locking maximizes the opportunities for concurrent execution while preserving correctness, but increases both the number of locks and the frequency of lock operations. Adding to the frequency of these operations is the practice of using locks defensively --- such as in library code designed for use in both concurrent and single-threaded scenarios. If the library does not protect itself with locks, an engineering burden is placed on the library's users; if the library does use locks, it punishes those who use it only from a single thread. Biased locking is a dynamic protocol for eliminating this trade-off, in which the underlying run-time system optimizes lock operations by biasing a lock to a specific thread when the lock is dynamically found to be thread-local. Biased locking protocols are distinguished by how many opportunities for optimization are found, and what performance trade-offs for non-local locks are experienced. Of particular concern is the relatively high cost involved in revoking the bias of a lock, which makes existing biased locking protocols susceptible to performance pathologies for programs with specific patterns of contention.\n This work presents the biased locking protocol used in Jikes RVM, a high-throughput Java virtual machine. The protocol, dubbed Fable, builds on prior work by adding per-object-instance dynamic adaptation and inexpensive bias revocation. We describe the protocol, detail how it was implemented, and use it in offering the most thorough evaluation of Java locking protocols to date. Fable is shown to provide speed-ups over traditional Java locking across a broad spectrum of benchmarks while being robust to cases previous protocols handled poorly.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"52 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-08-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"20","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Principles and Practice of Programming in Java","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2093157.2093184","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 20

Abstract

Mutual-exclusion locking is the prevailing technique for protecting shared resources in concurrent programs. Fine-grained locking maximizes the opportunities for concurrent execution while preserving correctness, but increases both the number of locks and the frequency of lock operations. Adding to the frequency of these operations is the practice of using locks defensively --- such as in library code designed for use in both concurrent and single-threaded scenarios. If the library does not protect itself with locks, an engineering burden is placed on the library's users; if the library does use locks, it punishes those who use it only from a single thread. Biased locking is a dynamic protocol for eliminating this trade-off, in which the underlying run-time system optimizes lock operations by biasing a lock to a specific thread when the lock is dynamically found to be thread-local. Biased locking protocols are distinguished by how many opportunities for optimization are found, and what performance trade-offs for non-local locks are experienced. Of particular concern is the relatively high cost involved in revoking the bias of a lock, which makes existing biased locking protocols susceptible to performance pathologies for programs with specific patterns of contention. This work presents the biased locking protocol used in Jikes RVM, a high-throughput Java virtual machine. The protocol, dubbed Fable, builds on prior work by adding per-object-instance dynamic adaptation and inexpensive bias revocation. We describe the protocol, detail how it was implemented, and use it in offering the most thorough evaluation of Java locking protocols to date. Fable is shown to provide speed-ups over traditional Java locking across a broad spectrum of benchmarks while being robust to cases previous protocols handled poorly.
细粒度自适应偏置锁定
互斥锁是并发程序中保护共享资源的常用技术。细粒度锁定在保持正确性的同时最大化了并发执行的机会,但同时增加了锁的数量和锁操作的频率。防御性地使用锁的做法增加了这些操作的频率——比如在设计用于并发和单线程场景的库代码中。如果库不使用锁来保护自己,则会给库的用户带来工程负担;如果库确实使用了锁,它会惩罚那些只在单个线程中使用锁的人。偏置锁定是一种消除这种权衡的动态协议,在这种协议中,底层运行时系统在动态地发现锁是线程本地的时候,通过将锁偏置到特定线程来优化锁操作。有偏锁协议的区别在于找到了多少优化机会,以及非本地锁经历了哪些性能权衡。特别值得关注的是,撤销锁的偏置所涉及的相对较高的成本,这使得具有特定争用模式的程序的现有偏置锁定协议容易受到性能问题的影响。本文介绍了Jikes RVM(一个高吞吐量Java虚拟机)中使用的偏锁协议。这个被称为“寓言”的协议建立在先前工作的基础上,增加了每个对象实例的动态适应和廉价的偏见撤销。我们描述了该协议,详细介绍了它是如何实现的,并使用它对Java锁定协议进行了迄今为止最全面的评估。事实证明,在广泛的基准测试中,Fable提供了比传统Java锁定更快的速度,同时对以前协议处理不佳的情况也很健壮。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信