Abstract
To leverage the benefits of modern hardware, dynamic languages must support parallelism, and parallelism requires a virtual machine (VM) capable of parallel execution — a parallel VM. However, unrestricted concurrency and the dynamism of dynamic languages pose great challenges to the implementation of parallel VMs. In a dynamic language, a program changing itself is part of the language model. To help the VM, languages often choose memory models (MM) that weaken consistency guarantees. With lesser guarantees, local program state cannot be affected by every concurrent state change. And less interference allows a VM to make local assumptions about the program state which are not immediately violated. These local assumptions are essential for a VM’s just-in-time compiler for delivering state-of-the-art VM performance.
Unfortunately, some dynamic languages employ MMs that give exceedingly strong consistency guarantees and thereby hinder the development of parallel VMs. Such is the case in particular for languages that depend on a global interpreter lock, which mandates a MM with sequential consistency and instruction atomicity.
In this paper, we reflect on a first implementation of the Parallel RPython execution model, which facilitates the development of parallel VMs by decoupling language semantics from the synchronization mechanism used within the VM. The implementation addresses the challenges imposed by strong MMs through strict isolation of concurrent computations. This isolation builds on transactional parallel worlds, which are implemented with a novel combination of software techniques and the capabilities of modern hardware.
We evaluate a set of parallel Python programs on a parallel VM that relies on Parallel RPython’s implementation. Compared with a serial baseline VM that relies on a global interpreter lock, the parallel VM achieves speedups of up to 7.5× on 8 CPU cores. The evaluation shows that our realization of Parallel RPython meets the challenges of dynamic languages, and that it can serve as a solid foundation for the construction of parallel dynamic language VMs.
Supplemental Material
- Martín Abadi, Tim Harris, and Mojtaba Mehrara. 2009. Transactional Memory with Strong Atomicity Using Off-the-Shelf Memory Protection Hardware. In Proceedings of the 14th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’09) . ACM, New York, NY, USA, 185–196. Google Scholar
Digital Library
- Antonio Albano, Luca Cardelli, and Renzo Orsini. 1985. GALILEO: A Strongly-typed, Interactive Conceptual Language. ACM Trans. Database Syst. 10, 2 (June 1985), 230–260. Google Scholar
Digital Library
- Joe Armstrong. 2010. Erlang. Commun. ACM 53, 9 (Sept. 2010), 68–75. Google Scholar
Digital Library
- Malcolm Atkinson, Ken Chisholm, and Paul Cockshott. 1982. PS-algol: An Algol with a Persistent Heap. SIGPLAN Not. 17, 7 (July 1982), 24–31. Google Scholar
Digital Library
- Carl Friedrich Bolz, Antonio Cuni, Maciej Fijalkowski, and Armin Rigo. 2009. Tracing the Meta-Level: PyPy’s Tracing JIT Compiler. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS ’09) . ACM, New York, NY, USA, 18–25. Google Scholar
Digital Library
- Calin Cascaval, Colin Blundell, Maged Michael, Harold W. Cain, Peng Wu, Stefanie Chiras, and Siddhartha Chatterjee. 2008. Software Transactional Memory: Why Is It Only a Research Toy? Queue 6, 5 (Sept. 2008), 40:46–40:58. Google Scholar
Digital Library
- Craig Chambers, David Ungar, and Elgin Lee. 1989. An Efficient Implementation of SELF a Dynamically-Typed ObjectOriented Language Based on Prototypes. In Conference Proceedings on Object-Oriented Programming Systems, Languages and Applications (OOPSLA ’89) . ACM, New York, NY, USA, 49–70. Google Scholar
Digital Library
- Luke Dalessandro, Dave Dice, Michael Scott, Nir Shavit, and Michael Spear. 2010. Transactional Mutex Locks. In Euro-Par 2010 - Parallel Processing (Lecture Notes in Computer Science) . Springer, Berlin, Heidelberg, 2–13. Google Scholar
Digital Library
- Benoit Daloze, Stefan Marr, Daniele Bonetta, and Hanspeter Mössenböck. 2016. Efficient and Thread-Safe Objects for Dynamically-Typed Languages. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2016) . ACM, New York, NY, USA, 642–659. Google Scholar
Digital Library
- Benoit Daloze, Arie Tal, Stefan Marr, Hanspeter Mössenböck, and Erez Petrank. 2018. Parallelization of Dynamic Languages: Synchronizing Built-in Collections. In Proceedings of the 2018 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2018) . ACM.Google Scholar
Digital Library
- Alan Dearle. 1988. On the Construction of Persistent Programming Environments. Ph.D. Dissertation. AAIDX86382. Google Scholar
Digital Library
- Aleksandar Dragojević, Pascal Felber, Vincent Gramoli, and Rachid Guerraoui. 2011. Why STM Can Be More Than a Research Toy. Commun. ACM 54, 4 (April 2011), 70–77. Google Scholar
Digital Library
- IronPython. 2018. The IronPython Project. http://ironpython.net/.Google Scholar
- JRuby. 2018. Concurrency in JRuby. https://github.com/jruby/jruby/wiki/Concurrency-in-jruby.Google Scholar
- Jython. 2018. Jython Concurrency. http://www.jython.org/jythonbook/en/1.0/Concurrency.html.Google Scholar
- Robert R. Kessler and Mark R. Swanson. 1990. Concurrent Scheme. In Proceedings of the US/Japan Workshop on Parallel Lisp: Languages and Systems . Springer-Verlag, Berlin, Heidelberg, 200–234. http://dl.acm.org/citation.cfm?id=646454.693125 Google Scholar
Digital Library
- Johann M. Kraus and Hans A. Kestler. 2009. Multi-core Parallelization in Clojure: A Case Study. In Proceedings of the 6th European Lisp Workshop (ELW ’09) . ACM, New York, NY, USA, 8–17. Google Scholar
Digital Library
- Jochen Liedtke. 1993. A persistent system in real use — experiences of the first 13 years. In Proceedings of the Third International Workshop on Object Orientation in Operating Systems . IEEE, 2–11.Google Scholar
Cross Ref
- Yu David Liu, Xiaoqi Lu, and Scott F. Smith. 2008. Coqa: Concurrent Objects with Quantized Atomicity. In Proceedings of the Joint European Conferences on Theory and Practice of Software 17th International Conference on Compiler Construction (CC’08/ETAPS’08) . Springer-Verlag, Berlin, Heidelberg, 260–275. Google Scholar
Digital Library
- Cristian Mattarei, Clark Barrett, Shu-yu Guo, Bradley Nelson, and Ben Smith. 2018. EMME: A Formal Tool for ECMAScript Memory Model Evaluation. In Tools and Algorithms for the Construction and Analysis of Systems, Dirk Beyer and Marieke Huisman (Eds.). Springer International Publishing, Cham, 55–71.Google Scholar
- Remigius Meier, Armin Rigo, and Thomas R. Gross. 2016. Parallel Virtual Machines with RPython. In Proceedings of the 12th Symposium on Dynamic Languages (DLS 2016) . ACM, New York, NY, USA, 48–59. Google Scholar
Digital Library
- Dushyanth Narayanan and Orion Hodson. 2012. Whole-system Persistence. In Proceedings of the Seventeenth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS XVII) . ACM, New York, NY, USA, 401–410. Google Scholar
Digital Library
- Rei Odaira, Jose G. Castanos, and Hisanobu Tomari. 2014. Eliminating Global Interpreter Locks in Ruby Through Hardware Transactional Memory. In Proceedings of the 19th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’14) . ACM, New York, NY, USA, 131–142. Google Scholar
Digital Library
- PyPy. 2018. PyPy Benchmarks on Bitbucket. https://bitbucket.org/pypy/benchmarks.Google Scholar
- Python Software Foundation. 2018. Python FAQ. https://docs.python.org/2/faq/library.html#what-kinds-of-global-valuemutation-are-thread-safe.Google Scholar
- Armin Rigo and Samuele Pedroni. 2006. PyPy’s Approach to Virtual Machine Construction. In Companion to the 21st ACM SIGPLAN Symposium on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA ’06) . ACM, New York, NY, USA, 944–953. Google Scholar
Digital Library
- Nicholas Riley and Craig Zilles. 2006. Hardware Transactional Memory Support for Lightweight Dynamic Language Evolution. In Companion to the 21st ACM SIGPLAN Symposium on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA ’06) . ACM, New York, NY, USA, 998–1008. Google Scholar
Digital Library
- James Swaine, Kevin Tew, Peter Dinda, Robert Bruce Findler, and Matthew Flatt. 2010. Back to the Futures: Incremental Parallelization of Existing Sequential Runtime Systems. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’10) . ACM, New York, NY, USA, 583–597. Google Scholar
Digital Library
- Fuad Tabba. 2010. Adding Concurrency in Python Using a Commercial Processor’s Hardware Transactional Memory Support. SIGARCH Comput. Archit. News 38, 5 (April 2010), 12–19. Google Scholar
Digital Library
- Laurence Tratt. 2009. Dynamically Typed Languages. Advances in Computers 77, Jul (2009), 149–184.Google Scholar
Cross Ref
- Jons-Tobias Wamhoff, Christof Fetzer, Pascal Felber, Etienne Rivière, and Gilles Muller. 2013. FastLane: Improving Performance of Software Transactional Memory for Low Thread Counts. In Proceedings of the 18th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’13) . ACM, New York, NY, USA, 113–122. Google Scholar
Digital Library
- Christian Wimmer and Thomas Würthinger. 2012. Truffle: A Self-Optimizing Runtime System. In Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity (SPLASH ’12) . ACM, New York, NY, USA, 13–14. Google Scholar
Digital Library
- Thomas Würthinger, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Doug Simon, and Christian Wimmer. 2012. Self-optimizing AST Interpreters. In Proceedings of the 8th Symposium on Dynamic Languages (DLS ’12). ACM, New York, NY, USA, 73–82. Google Scholar
Digital Library
Index Terms
Virtual machine design for parallel dynamic programming languages
Recommendations
Reflections on the compatibility, performance, and scalability of parallel Python
DLS 2019: Proceedings of the 15th ACM SIGPLAN International Symposium on Dynamic LanguagesToday's hardware is increasingly parallel, and to increase performance, applications must be able to use this parallelism. Hence, programming languages must provide the means for parallel execution. The language Python offers a multithreading, shared-...
Parallel virtual machines with RPython
DLS 2016: Proceedings of the 12th Symposium on Dynamic LanguagesThe RPython framework takes an interpreter for a dynamic language as its input and produces a Virtual Machine (VM) for that language. RPython is being used to develop PyPy, a high-performance Python interpreter. However, the produced VM does not support ...
Parallel virtual machines with RPython
DLS '16The RPython framework takes an interpreter for a dynamic language as its input and produces a Virtual Machine (VM) for that language. RPython is being used to develop PyPy, a high-performance Python interpreter. However, the produced VM does not support ...






Comments