细粒度锁在并行编程与并发软件设计中起着重要的作用.然而,细粒度锁对程序员具有较高的要求,通常在设计细粒度锁并发程序时会带来算法复杂,编程困难,程序易出错等问题.提出一种链状数据结构的细粒度加锁方法,并实现自动转换含有形状和共享标注的程序为细粒度锁代码的翻译器,为了使生成的代码具有无死锁,引入了一致性加锁协议,实验结果表明,基于本文方法能够自动为链状数据结构操作添加细粒度锁,生成的代码具有较高的并发性.
Fine-grained locking is extremely important in multi-processor programming and concurrent software design. However, fine-grained locking is notoriously difficult for programmers to get right - mistakes can lead to data races, conservative protection placement ,the program error-prone and other issues. This paper presents an automatic fine-grained locking for linked data structure technique. We have implemented a translator which takes a program annotated with shape declaration and share effect provided by pro- grammer and automatically instruments the fine-grained locking, experimental results show that this method can automatically instru- ment fine-grained locking for linked data structure, making the program a higher concurrency.