Hostname: page-component-76fb5796d-22dnz Total loading time: 0 Render date: 2024-04-25T12:33:07.737Z Has data issue: false hasContentIssue false

Lock-free atom garbage collection for multithreaded Prolog

Published online by Cambridge University Press:  14 October 2016

JAN WIELEMAKER
Affiliation:
VU University Amsterdam, The Netherlands CWI Amsterdam, The Netherlands (e-mail: J.Wielemaker@vu.nl)
KERI HARRIS
Affiliation:
SecuritEase, New Zealand (e-mail: keri@gentoo.org)

Abstract

The runtime system of dynamic languages such as Prolog or Lisp and their derivatives contain a symbol table, in Prolog often called the atom table. A simple dynamically resizing hash-table used to be an adequate way to implement this table. As Prolog becomes fashionable for 24 × 7 server processes we need to deal with atom garbage collection and concurrent access to the atom table. Classical lock-based implementations to ensure consistency of the atom table scale poorly and a stop-the-world approach to implement atom garbage collection quickly becomes a bottle-neck, making Prolog unsuitable for soft real-time applications. In this article we describe a novel implementation for the atom table using lock-free techniques where the atom-table remains accessible even during atom garbage collection. Relying only on CAS (Compare And Swap) and not on external libraries, the implementation is straightforward and portable.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2016 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Boehm, H.-J. 1993. Space efficient conservative garbage collection. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, PLDI '93. ACM, New York, NY, USA, 197206.CrossRefGoogle Scholar
Creutz, M. 2003. Unsupervised segmentation of words using prior distributions of morph length and frequency. In Proceedings of the 41st Annual Meeting on Association for Computational Linguistics - Volume 1, ACL '03. Association for Computational Linguistics, Stroudsburg, PA, USA, 280287.Google Scholar
Desnoyers, M., McKenney, P. E., Stern, A. S., Dagenais, M. R. and Walpole, J. 2012. User-level implementations of read-copy update. IEEE Transactions on Parallel and Distributed Systems 23, 2, 375382.Google Scholar
Harris, T., Marlow, S., Jones, S. L. P. and Herlihy, M. 2008. Composable memory transactions. Commun. ACM 51, 8, 91100.Google Scholar
Klyne, G. and Carroll, J. J. 2004. Resource description framework (RDF): Concepts and abstract syntax. World Wide Web Consortium, Recommendation REC-rdf-concepts-20040210.Google Scholar
Lindgren, T. 2005. Atom garbage collection. In Proceedings of the 2005 ACM SIGPLAN Workshop on Erlang, ERLANG '05. ACM, New York, NY, USA, 4045.CrossRefGoogle Scholar
Michael, M. M. 2004. Hazard pointers: safe memory reclamation for lock-free objects. IEEE Transactions on Parallel and Distributed Systems 15, 6 (June), 491504.Google Scholar
Tarau, P. 2011. Integrated symbol table, engine and heap memory management in multi-engine Prolog. In Proceedings of the International Symposium on Memory Management. ISMM '11. ACM, New York, NY, USA, 129138.CrossRefGoogle Scholar
Triplett, J., McKenney, P. E. and Walpole, J. 2011. Resizable, scalable, concurrent hash tables via relativistic programming. In 2011 USENIX Annual Technical Conference, Portland, OR, USA, June 15-17, 2011, Nieh, J. and Waldspurger, C. A., Eds. USENIX Association.Google Scholar
Wielemaker, J. 2003. Native preemptive threads in SWI-Prolog. In Logic Programming, 19th International Conference, ICLP 2003, Mumbai, India, December 9–13, 2003, Proceedings, Palamidessi, C., Ed. Lecture Notes in Computer Science, vol. 2916. Springer, 331345.Google Scholar