Abstract
Monitors, such as Java classes with synchronized methods, are a convenient and safe abstraction for designing and reasoning about multithreaded object-oriented programs. However, the straightforward implementation of monitors can be inefficient, particularly in programs in which the majority of calls are to read-only methods. We introduce the optimistic readers program transformation, which may be implemented either as a compiler optimization, or as a “design pattern.” This transformation produces an implementation whose observable behavior is equivalent to that of a monitor, but in which read-only methods do not acquire locks or perform any shared writes. As a result, programmers can reason about their programs as if each shared object were implemented using mutual exclusion, while achieving the performance benefits of unsynchronized reads. We present the program transformation using the platform-independent abstraction CRF. We then demonstrate the performance of this transformation as applied to benchmarks derived from the core module of a practical system — a Java-based publish-subscribe router. We compare the performance of the optimistic readers transformation to unoptimized synchronized methods and to reader and writer locks.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Bacon, D. F., Strom, R. E., and Tarafdar, A., “Guava: A Dialect of Java without Data Races,” In OOPSLA 2000 Conference Proceedings, pp. 382–400, October 2000.
Gharachorloo, K. “Memory Consistency Models for Shared Memory Multiprocessors, ” PhD thesis, Stanford University, 1995.
Gosling, J., Joy, B., and Steele, G., The Java Language Specification. Addison Wesley, Menlo Park, CA, 1996.
Pugh, W., “ Fixing the Java Memory Model”. In Proceeedings of the ACM Java Grande Conference, June 1999.
Pugh, W., “Semantics of Multithreaded Java”, URL: http://www.cs.umd.edu/~pugh/java/memoryModel/semantics.pdf
Maessen, J-W., Arvind, and Shen, X., “ Improving the Java Memory Model Using CRF”, In OOPSLA 2000 Conference Proceedings, pp. 1–12., October 2000.
Shen, X., Arvind, and Rudolph, L. “Commit-Reconcile and Fences (CRF): A New Memory Model for Architects and Compiler Writers” In Proceedings of the 26th International Symposium On Computer Architecture, Atlanta, Georgia, May 1999.
Java Memory Model Workshop, URL: http://www.cs.umd.edu/~pugh/java/memoryModel/workshop.
Eswaran, K.P., Gray, J., Lorie, R. A., Traiger, I.L., “The Notions of Consistency and Predicate Locks in a Database System.” CACM 19(11), pp. 624–633, 1976.
Banavar, G., Chandra, T., Mukherjee, B., Nagarajarao, J., Strom, R., and Sturman, D., “An Efficient Multicast Protocol for Content-based Publish-Subscribe Systems”, In Proceedings of the International Conference on Distributed Computing Systems, 1999.
Kung, H.T., and. Robinson, J.T., “On Optimistic Methods for Concurrency Control”, ACM TODS, v. 6, no. 2, pp. 213–226, June 1981.
Reiman, M., and. Wright, P.E., “Performance analysis of concurrent-read exclusivewrite”. In Joint International Conference on Measurement and Modeling of Computer Systems (ACM SIGMETRICS) San Diego, CA, Pages 168–177, May 1991.
Herlihy, M. “A Methodology for Implementing Highly Concurrent Data Objects.” ACM Transactions on Programming Languages and Systems, v. 15, no. 5, pp. 745–770, November 1993.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Strom, R., Auerbach, J. (2001). The Optimistic Readers Transformation. In: Knudsen, J.L. (eds) ECOOP 2001 — Object-Oriented Programming. ECOOP 2001. Lecture Notes in Computer Science, vol 2072. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45337-7_15
Download citation
DOI: https://doi.org/10.1007/3-540-45337-7_15
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-42206-8
Online ISBN: 978-3-540-45337-6
eBook Packages: Springer Book Archive