Skip to main content Accessibility help

Lock-free atom garbage collection for multithreaded Prolog

  • JAN WIELEMAKER (a1) (a2) and KERI HARRIS (a3)
  • Please note a correction has been issued for this article.

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.

Hide All
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.
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.
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.
Harris, T., Marlow, S., Jones, S. L. P. and Herlihy, M. 2008. Composable memory transactions. Commun. ACM 51, 8, 91100.
Klyne, G. and Carroll, J. J. 2004. Resource description framework (RDF): Concepts and abstract syntax. World Wide Web Consortium, Recommendation REC-rdf-concepts-20040210.
Lindgren, T. 2005. Atom garbage collection. In Proceedings of the 2005 ACM SIGPLAN Workshop on Erlang, ERLANG '05. ACM, New York, NY, USA, 4045.
Michael, M. M. 2004. Hazard pointers: safe memory reclamation for lock-free objects. IEEE Transactions on Parallel and Distributed Systems 15, 6 (June), 491504.
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.
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.
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.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *



Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

A correction has been issued for this article: