The Optimistic Readers Transformation

  • Robert Strom
  • Joshua Auerbach
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2072)


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.


Shared Memory Hash Table Memory Model Version Number Instance Variable 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    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.Google Scholar
  2. 2.
    Gharachorloo, K. “Memory Consistency Models for Shared Memory Multiprocessors, ” PhD thesis, Stanford University, 1995.Google Scholar
  3. 3.
    Gosling, J., Joy, B., and Steele, G., The Java Language Specification. Addison Wesley, Menlo Park, CA, 1996.zbMATHGoogle Scholar
  4. 4.
    Pugh, W., “ Fixing the Java Memory Model”. In Proceeedings of the ACM Java Grande Conference, June 1999.Google Scholar
  5. 5.
    Pugh, W., “Semantics of Multithreaded Java”, URL:
  6. 6.
    Maessen, J-W., Arvind, and Shen, X., “ Improving the Java Memory Model Using CRF”, In OOPSLA 2000 Conference Proceedings, pp. 1–12., October 2000.Google Scholar
  7. 7.
    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.Google Scholar
  8. 8.
  9. 9.
    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.zbMATHMathSciNetGoogle Scholar
  10. 10.
    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.Google Scholar
  11. 11.
    Kung, H.T., and. Robinson, J.T., “On Optimistic Methods for Concurrency Control”, ACM TODS, v. 6, no. 2, pp. 213–226, June 1981.Google Scholar
  12. 12.
    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.Google Scholar
  13. 13.
    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.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Robert Strom
    • 1
  • Joshua Auerbach
    • 1
  1. 1.IBM T.J. Watson Research CenterHawthorneUSA

Personalised recommendations