paperbot · PL 论文追踪

全部论文 待读 收藏

P2 FineLock: automatically refactoring coarse-grained locks into fine-grained locks

FineLock:自动将粗粒度锁重构为细粒度锁
ISSTA Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis2020匹配度 2/10 · 论文属于程序分析与自动重构,但应用场景是并发锁优化,未涉及 ML/Agentic 程序、LLM 辅助分析或浮点/贝叶斯程序分析,与用户研究画像的核心交叉方向无直接关联。引用 17 inbox
Yang Zhang, Shuai Shao, Juan Zhai, Shiqing Ma
crossref: 2026-09-12

AI 速览

一句话:提出基于程序分析与下推自动机的自动重构工具 FineLock,将粗粒度锁转换为细粒度锁以降低锁竞争。

锁是共享资源互斥访问的常用同步机制,但基于锁的并发程序容易因锁竞争而性能低、扩展性差;锁粒度不当会进一步加剧竞争。细粒度锁可缓解竞争,却难以正确使用,手工将粗粒度锁转换为细粒度锁既繁琐易错,又需要大量专门经验。本文提出结合程序分析与下推自动机的自动化重构方法,将粗粒度锁转换为细粒度锁以降低锁竞争。作者实现原型工具 FineLock,并在5个项目上评估。结果显示,FineLock 平均27.6秒可重构1546个锁,其中129个粗粒度锁被转换为细粒度锁,1417个被转换为读写锁;自动给出潜在重构建议,为开发者节省大量精力。

问题
粗粒度锁容易导致锁竞争、降低并发性能与可扩展性,但手工将锁细粒度化重构困难、易错且依赖专家经验。
方法
利用程序分析与下推自动机识别锁保护的共享资源及访问模式,自动将粗粒度锁转换为细粒度锁或读写锁。
评估
实现原型工具 FineLock,在5个项目上评估;平均27.6秒重构1546个锁,其中129个转细粒度锁、1417个转读写锁。
原文摘要(Abstract)

Lock is a frequently-used synchronization mechanism to enforce exclusive access to a shared resource. However, lock-based concurrent programs are susceptible to lock contention, which leads to low performance and poor scalability. Furthermore, inappropriate granularity of a lock makes lock contention even worse. Compared to coarse-grained lock, fine-grained lock can mitigate lock contention but difficult to use. Converting coarse-grained lock into fine-grained lock manually is not only error-prone and tedious, but also requires a lot of expertise. In this paper, we propose to leverage program analysis techniques and pushdown automaton to automatically covert coarse-grained locks into fine-grained locks to reduce lock contention. We developed a prototype FineLock and evaluates it on 5 projects. The evaluation results demonstrate FineLock can refactor 1,546 locks in an average of 27.6 seconds, including converting 129 coarse-grained locks into fine-grained locks and 1,417 coarse-grained locks into read/write locks. By automatically providing potential refactoring recommendations, our tool saves a lot of efforts for developers.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot6033,
  title = {FineLock: automatically refactoring coarse-grained locks into fine-grained locks},
  author = {Yang Zhang and Shuai Shao and Juan Zhai and Shiqing Ma},
  booktitle = {ISSTA},
  year = {2020},
  doi = {10.1145/3395363.3404368}
}