Abstract

StampedLock, proposed in JDK 1.8, provides many interesting features, such as optimistic read locks and upgrading/downgrading locks to improve the design of concurrent programs instead of employing pure read/write locks. Existing refactorings have proposed algorithms to convert locks, but there are a few refactorings that use these promising features of StampedLock. To illustrate a possible refactoring, this paper first shows three code transformations based on StampedLock. Then, this paper presents CLOCK, an automated refactoring tool that helps developers convert the synchronized lock into the StampedLock. An algorithm for reentrance analysis is proposed for the precondition validation. The write lock, read lock, optimistic read lock, and upgrading/downgrading lock are inferred and refactored. CLOCK is evaluated with the SPECjbb2005 benchmark and two real-world applications, Xalan and FOP. A total of 66 classes are modified by searching approximately 395KSLOC and applying the refactoring, achieving an average of 22 classes per benchmark. The experimental results show that CLOCK can help developers with refactoring for StampedLock and save developer effort.

Highlights

  • Lock, as one of the synchronization mechanisms, is used to ensure the correctness of shared resources access in concurrent programs

  • This paper focuses on refactoring support for the advanced locking operations, e.g., upgrading/downgrading locks and optimistic read locks provided by StampedLock

  • We propose an algorithm for reentrance analysis as the precondition validation and the regulation for inferring the write lock, read lock, optimistic read lock and the upgrading/downgrading lock

Read more

Summary

INTRODUCTION

As one of the synchronization mechanisms, is used to ensure the correctness of shared resources access in concurrent programs. Lock contention often leads to poor scalability and low performance, which comprise as a main challenge in the multi-core era Various synchronization mechanisms, such as software transactional memory (STM) [1], [2] and the lock-free algorithm (LFA) [3], exist for concurrent programming. Similar to ReentrantReadWriteLock, StampedLock has read and write locks by the methods asReadLock() and asWriteLock(), but it does not seem to suffer from severe starvation Both academic and industrial sectors have proposed techniques and tools for refactoring among locks in the past few years. Automated refactoring tools need to know where and how to upgrade/ downgrade a lock To meet these challenges, this paper focuses on refactoring support for the advanced locking operations, e.g., upgrading/downgrading locks and optimistic read locks provided by StampedLock.

MOTIVATING EXAMPLES
HANDLING PRACTICAL ISSUES
IMPLEMENTATION
EVALUATION
RESEARCH QUESTIONS
REFACTORING FOR LOCKS Many previous works of concurrency-oriented refactoring focused on how to convert locks
VIII. CONCLUSION
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call