skip to main content
research-article

AutoSynch: an automatic-signal monitor based on predicate tagging

Published:16 June 2013Publication History
Skip Abstract Section

Abstract

Most programming languages use monitors with explicit signals for synchronization in shared-memory programs. Requiring programmers to signal threads explicitly results in many concurrency bugs due to missed notifications, or notifications on wrong condition variables. In this paper, we describe an implementation of an automatic signaling monitor in Java called AutoSynch that eliminates such concurrency bugs by removing the burden of signaling from the programmer. We show that the belief that automatic signaling monitors are prohibitively expensive is wrong. For most problems, programs based on AutoSynch are almost as fast as those based on explicit signaling. For some, AutoSynch is even faster than explicit signaling because it never uses signalAll, whereas the programmers end up using signalAll with the explicit signal mechanism.

AutoSynch} achieves efficiency in synchronization based on three novel ideas. We introduce an operation called closure that enables the predicate evaluation in every thread, thereby reducing context switches during the execution of the program. Secondly, AutoSynch avoids signalAll by using a property called relay invariance that guarantees that whenever possible there is always at least one thread whose condition is true which has been signaled. Finally, AutoSynch uses a technique called predicate tagging to efficiently determine a thread that should be signaled. To evaluate the efficiency of AutoSynch, we have implemented many different well-known synchronization problems such as the producers/consumers problem, the readers/writers problems, and the dining philosophers problem. The results show that AutoSynch is almost as efficient as the explicit-signal monitor and even more efficient for some cases.

References

  1. G. R. Andrews. Multithreaded, Parallel, and Distributed Programming. Addison-Wesley, MA, 2000.Google ScholarGoogle Scholar
  2. P. Brinch Hansen, The Programming language concurrent Pascal. IEEE Trans. Software Engineering, 1(2), 199--207, June, 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. P. Brinch Hansen, Structured multiprogramming. Commun. ACM 15(7), 574--578, July 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. A. Buhr, M. Fortier, and M. H. Coffin, Monitor Classification. ACM Computing Surveys, ACM, 27(1), 63--107, Mar. 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. A. Buhr and A. S. Harji, Implicit-signal monitors. ACM Transactions on Programming Languages and Systems ACM, 27(6):1270--1343, Nov. 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. D. R. Butenhof, Programming With Posix Threads. Addison-Wesley, MA, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. J. Courtois, F. Heymans, D. L. Parnars, Concurrent control with "readers" and "writers". Commun. ACM, 14(10), 667--668, Oct. 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. E. W. Dijkstra, Cooperating Sequential Processes. Technical Report EWD-123, 1965. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. E. W. Dijkstra, The structure of the "THE"-multiprogramming system.Commun. ACM, 11(5), 341--346, May 1968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. E. W. Dijkstra, Hierarchical Ordering of Sequential Processes. Acta Informatica, 1, 115--138, 1971.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Gosling, B. Joy, and G. Steele, The Java Language Specification. 2nd ed. Addison-Wesley, MA, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. V. K. Garg and N. Mittal, A Critique of Java for Concurrent Programming, IEEE Distributed Systems online 6(9), 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. Hejisberg, S. Wiltamuth, and P. Golde, C# Language Specification. Addison-Wesley, MA, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. C. A. R. Hoare, Monitors: an operating system structuring concept. Commun. ACM, 17(10), 549--557, Oct. 1974. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Y.-J. Joung, Asynchronous group mutual exclusion. ACM Symposium on Principles of Distributed Computing, 51--60, Aug. 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. L. W. Kessels. An alternative to event queues for synchronization in monitors. Commun. ACM, 20(7), 500--503, July 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. V. Kodaganallur, Incorporating language processing into Java applications: a JavaCC tutorial. IEEE Software, 21(4), 70--77, July-Aug. 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. D. Lea, The java.util.concurrent synchronizer framework. Science of Computer Programming, 58(3), 293--309, Dec. 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. B. Stroustrup, The C++ Programming Language. 3rd ed. Addison- Wesley, MA, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Yourkit LLC, Yourkit profiler. http://www.yourkir.comGoogle ScholarGoogle Scholar

Index Terms

  1. AutoSynch: an automatic-signal monitor based on predicate tagging

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 48, Issue 6
        PLDI '13
        June 2013
        515 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2499370
        Issue’s Table of Contents
        • cover image ACM Conferences
          PLDI '13: Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation
          June 2013
          546 pages
          ISBN:9781450320146
          DOI:10.1145/2491956

        Copyright © 2013 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 16 June 2013

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!