[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
research-article
Open access

Parallelization of dynamic languages: synchronizing built-in collections

Published: 24 October 2018 Publication History

Abstract

Dynamic programming languages such as Python and Ruby are widely used, and much effort is spent on making them efficient. One substantial research effort in this direction is the enabling of parallel code execution. While there has been significant progress, making dynamic collections efficient, scalable, and thread-safe is an open issue. Typical programs in dynamic languages use few but versatile collection types. Such collections are an important ingredient of dynamic environments, but are difficult to make safe, efficient, and scalable.
In this paper, we propose an approach for efficient and concurrent collections by gradually increasing synchronization levels according to the dynamic needs of each collection instance. Collections reachable only by a single thread have no synchronization, arrays accessed in bounds have minimal synchronization, and for the general case, we adopt the Layout Lock paradigm and extend its design with a lightweight version that fits the setting of dynamic languages. We apply our approach to Ruby's Array and Hash collections. Our experiments show that our approach has no overhead on single-threaded benchmarks, scales linearly for Array and Hash accesses, achieves the same scalability as Fortran and Java for classic parallel algorithms, and scales better than other Ruby implementations on Ruby workloads.

Supplementary Material

Auxiliary Archive (oopsla18main-p21-p-aux.zip)
This is the supplementary material and annex for the paper Parallelization of Dynamic Languages: Synchronizing Built-in Collections. It complements the paper by reasoning about the correctness of the Lightweight Layout Lock, discussing safe publication of shared collections and adding a table of raw data.
WEBM File (a108-daloze.webm)

References

[1]
David H. Bailey, Eric Barszcz, John T. Barton, David S. Browning, Robert L. Carter, Leonardo Dagum, Rod A. Fatoohi, Paul O. Frederickson, Thomas A. Lasinski, Rob S. Schreiber, et al. 1991. The NAS Parallel Benchmarks. The International Journal of Supercomputing Applications 5, 3 (1991), 63–73.
[2]
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, 18–25.
[3]
Carl Friedrich Bolz, Lukas Diekmann, and Laurence Tratt. 2013. Storage Strategies for Collections in Dynamically Typed Languages. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’13). ACM, 167–182.
[4]
Carl Friedrich Bolz and Laurence Tratt. 2013. The Impact of Meta-Tracing on VM Design and Implementation. Science of Computer Programming (2013).
[5]
Gregory Brown, Brad Ediger, Alexander Mankuta, et al. 2017a. Prawn: Fast, Nimble PDF Generation For Ruby. http: //prawnpdf.org/
[6]
Gregory Brown, Brad Ediger, Alexander Mankuta, et al. 2017b. Prawn::SynchronizedCache with a Mutex for JRuby. https://github.com/prawnpdf/prawn/blob/61d46791/lib/prawn/utilities.rb
[7]
Craig Chambers, David Ungar, and Elgin Lee. 1989. An Efficient Implementation of SELF a Dynamically-Typed ObjectOriented Language Based on Prototypes. In Proceedings on Object-Oriented Programming Systems, Languages and Applications (OOPSLA’89). ACM, 49–70.
[8]
Daniel Clifford, Hannes Payer, Michael Stanton, and Ben L. Titzer. 2015. Memento Mori: Dynamic Allocation-site-based Optimizations. In Proceedings of the 2015 International Symposium on Memory Management (ISMM ’15). ACM, 105–117.
[9]
Nachshon Cohen, Arie Tal, and Erez Petrank. 2017. Layout Lock: A Scalable Locking Paradigm for Concurrent Data Layout Modifications. In Proceedings of the 22Nd ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’17). ACM, 17–29.
[10]
Diego Costa, Artur Andrzejak, Janos Seboek, and David Lo. 2017. Empirical Study of Usage and Performance of Java Collections. In Proceedings of the 8th ACM/SPEC on International Conference on Performance Engineering (ICPE’17). ACM, 389–400.
[11]
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 International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’16). ACM, 642–659.
[12]
Benoit Daloze, Chris Seaton, Daniele Bonetta, and Hanspeter Mössenböck. 2015. Techniques and Applications for GuestLanguage Safepoints. In Proceedings of the 10th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS ’15). 1–10.
[13]
Benoit Daloze, Arie Tal, Stefan Marr, Hanspeter Mössenböck, and Erez Petrank. 2018. Supplementary Material for: Parallelization of Dynamic Languages: Synchronizing Built-in Collections. In Proceedings of the 2018 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA’18).
[14]
Jerry D’Antonio and Petr Chalupa. 2017. Concurrent Ruby – Modern concurrency tools for Ruby. http://www. concurrent-ruby.com
[15]
Mattias De Wael, Stefan Marr, Joeri De Koster, Jennifer B. Sartor, and Wolfgang De Meuter. 2015. Just-in-Time Data Structures. In Proceedings of the 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward! ’15). ACM, 61–75.
[16]
Ulan Degenbaev, Jochen Eisinger, Manfred Ernst, Ross McIlroy, and Hannes Payer. 2016. Idle Time Garbage Collection Scheduling. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’16). ACM, 570–583.
[17]
Liang Gong, Michael Pradel, and Koushik Sen. 2015. JITProf: Pinpointing JIT-unfriendly JavaScript Code. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering (ESEC/FSE 2015). ACM, 357–368.
[18]
David Heinemeier Hansson et al. 2018. Ruby on Rails - A web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. http://rubyonrails.org/
[19]
Tim Harris, James Larus, and Ravi Rajwar. 2010. Transactional Memory, 2nd Edition (2nd ed.). Morgan and Claypool Publishers.
[20]
Timothy L. Harris. 2001. A Pragmatic Implementation of Non-Blocking Linked-Lists. In Proceedings of the 15th International Conference on Distributed Computing (DISC ’01). Springer, 300–314.
[21]
Maurice Herlihy and Nir Shavit. 2011. The Art of Multiprocessor Programming. Morgan Kaufmann.
[22]
JRuby. 2008. JRuby’s threaded-reverse benchmark. https://github.com/jruby/jruby/blob/a0a3e4bd22/test/bench/bench_ threaded_reverse.rb
[23]
Josh Juneau, Jim Baker, Frank Wierzbicki, Leo Soto, and Victor Ng. 2010. The Definitive Guide to Jython: Python for the Java Platform. Apress.
[24]
Hemant Kumar. 2013. Bug report on the RubyGems project: Thread issues with JRuby. https://github.com/rubygems/ rubygems/issues/597
[25]
Yi Lin, Kunshan Wang, Stephen M. Blackburn, Antony L. Hosking, and Michael Norrish. 2015. Stop and Go: Understanding Yieldpoint Behavior. In Proceedings of the 2015 International Symposium on Memory Management (ISMM ’15). ACM, 70–80.
[26]
Stefan Marr and Benoit Daloze. 2018. Few Versatile vs. Many Specialized Collections – How to design a collection library for exploratory programming?. In Proceedings of the 4th Programming Experience Workshop (PX/18). ACM.
[27]
Stefan Marr, Benoit Daloze, and Hanspeter Mössenböck. 2016. Cross-Language Compiler Benchmarking—Are We Fast Yet?. In Proceedings of the 12th Symposium on Dynamic Languages (DLS’16). ACM, 120–131.
[28]
Remigius Meier, Armin Rigo, and Thomas R. Gross. 2016. Parallel Virtual Machines with RPython. In Proceedings of the 12th Symposium on Dynamic Languages (DLS ’16). ACM, 48–59.
[29]
Remigius Meier, Armin Rigo, and Thomas R. Gross. 2018. Virtual Machine Design for Parallel Dynamic Programming Languages. In Proceedings of the 2018 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’18). ACM.
[30]
Mozilla. 2018. SharedArrayBuffer Documentation. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/ Global_Objects/SharedArrayBuffer
[31]
Ryan R. Newton, Peter P. Fogg, and Ali Varamesh. 2015. Adaptive Lock-Free Maps: Purely-Functional to Scalable. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP 2015). ACM, 218–229.
[32]
Takafumi Nose. 2013. Ruby version of NAS Parallel Benchmarks 3.0. https://github.com/plus7/npb_ruby
[33]
Charles Nutter, Thomas Enebo, Ola Bini, Nick Sieger, et al. 2018. JRuby – The Ruby Programming Language on the JVM. http://jruby.org/
[34]
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, 131–142.
[35]
Tim Peierls, Brian Goetz, Joshua Bloch, Joseph Bowbeer, Doug Lea, and David Holmes. 2005. Java Concurrency in Practice. Addison-Wesley Professional.
[36]
Mike Perham. 2017. Sidekiq – Simple, efficient background processing for Ruby. https://sidekiq.org/
[37]
Evan Phoenix, Brian Shirai, Ryan Davis, Dirkjan Bussink, et al. 2018. Rubinius – An Implementation of Ruby Using the Smalltalk-80 VM Design. https://rubinius.com/
[38]
Filip Pizlo. 2017. Concurrent JavaScript: It can work! https://webkit.org/blog/7846/concurrent-javascript-it-can-work/
[39]
William Pugh et al. 2004. JSR 133 - Java Memory Model and Thread Specification Revision. http://www.cs.umd.edu/~pugh/ java/memoryModel/jsr133.pdf
[40]
Rails Project. 2018. Threading and Code Execution in Rails. http://edgeguides.rubyonrails.org/threading_and_code_ execution.html
[41]
Chris Seaton, Benoit Daloze, Kevin Menard, Petr Chalupa, Brandon Fish, and Duncan MacGregor. 2017. TruffleRuby – A High Performance Implementation of the Ruby Programming Language. https://github.com/graalvm/truffleruby
[42]
Brian Shirai. 2016. Bug report on the Bundler project: Unsynchronized, concurrent modification of Set instance. https: //github.com/bundler/bundler/issues/5142
[43]
Brian Shirai. 2018. Bug report on the Bundler project: Unsychronized concurrent updates of Hash. https://github.com/ bundler/bundler/issues/6274
[44]
Vincent St-Amour and Shu-yu Guo. 2015. Optimization Coaching for JavaScript. In 29th European Conference on ObjectOriented Programming (ECOOP 2015) (LIPIcs), Vol. 37. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 271–295.
[45]
Lukas Stadler, Thomas Würthinger, and Hanspeter Mössenböck. 2014. Partial Escape Analysis and Scalar Replacement for Java. In Proceedings of Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO ’14). ACM, 165–174.
[46]
Håkan Sundell and Philippas Tsigas. 2005. Lock-Free and Practical Doubly Linked List-Based Deques Using Single-Word Compare-and-Swap. Principles of Distributed Systems (2005), 240–255. arXiv: arXiv:cs/0408016v1
[47]
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, 583–597.
[48]
Kevin Tew, James Swaine, Matthew Flatt, Robert Bruce Findler, and Peter Dinda. 2011. Places: Adding Message-Passing Parallelism to Racket. In Proceedings of the 7th Symposium on Dynamic Languages (DLS ’11). ACM, 85–96.
[49]
Thomas Würthinger, Christian Wimmer, Christian Humer, Andreas Wöß, Lukas Stadler, Chris Seaton, Gilles Duboscq, Doug Simon, and Matthias Grimmer. 2017. Practical Partial Evaluation for High-performance Dynamic Language Runtimes. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, 662–676.
[50]
Andreas Wöß, Christian Wirth, Daniele Bonetta, Chris Seaton, Christian Humer, and Hanspeter Mössenböck. 2014. An Object Storage Model for the Truffle Language Implementation Framework. In Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools (PPPJ ’14). ACM, 133–144.
[51]
Thomas Würthinger, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Doug Simon, and Christian Wimmer. 2012. SelfOptimizing AST Interpreters. In Proceedings of the 8th Dynamic Languages Symposium (DLS ’12). 73–82.
[52]
Guoqing Xu. 2013. CoCo: Sound and Adaptive Replacement of Java Collections. In Proceedings of the 27th European Conference on Object-Oriented Programming (ECOOP’13). Springer-Verlag, 1–26.

Cited By

View all
  • (2023)EVMTracer: Dynamic Analysis of the Parallelization and Redundancy Potential in the Ethereum Virtual MachineIEEE Access10.1109/ACCESS.2023.326727711(47159-47178)Online publication date: 2023
  • (2022)Who You Gonna Call: Analyzing the Run-Time Call-Site Behavior of Ruby ApplicationsProceedings of the 18th ACM SIGPLAN International Symposium on Dynamic Languages10.1145/3563834.3567538(15-28)Online publication date: 29-Nov-2022
  • (2022)Concurrent sizeProceedings of the ACM on Programming Languages10.1145/35633006:OOPSLA2(345-372)Online publication date: 31-Oct-2022
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 2, Issue OOPSLA
November 2018
1656 pages
EISSN:2475-1421
DOI:10.1145/3288538
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 24 October 2018
Published in PACMPL Volume 2, Issue OOPSLA

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Collections
  2. Concurrency
  3. Dynamically-typed languages
  4. Graal
  5. Ruby
  6. Thread Safety
  7. Truffle

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)130
  • Downloads (Last 6 weeks)12
Reflects downloads up to 18 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2023)EVMTracer: Dynamic Analysis of the Parallelization and Redundancy Potential in the Ethereum Virtual MachineIEEE Access10.1109/ACCESS.2023.326727711(47159-47178)Online publication date: 2023
  • (2022)Who You Gonna Call: Analyzing the Run-Time Call-Site Behavior of Ruby ApplicationsProceedings of the 18th ACM SIGPLAN International Symposium on Dynamic Languages10.1145/3563834.3567538(15-28)Online publication date: 29-Nov-2022
  • (2022)Concurrent sizeProceedings of the ACM on Programming Languages10.1145/35633006:OOPSLA2(345-372)Online publication date: 31-Oct-2022
  • (2021)On power capping and performance optimization of multithreaded applicationsConcurrency and Computation: Practice and Experience10.1002/cpe.620533:13Online publication date: 27-Jan-2021
  • (2019)Reflections on the compatibility, performance, and scalability of parallel PythonProceedings of the 15th ACM SIGPLAN International Symposium on Dynamic Languages10.1145/3359619.3359747(91-103)Online publication date: 20-Oct-2019
  • (2019)Concurrent marking of shape-changing objectsProceedings of the 2019 ACM SIGPLAN International Symposium on Memory Management10.1145/3315573.3329978(89-102)Online publication date: 23-Jun-2019
  • (2018)Virtual machine design for parallel dynamic programming languagesProceedings of the ACM on Programming Languages10.1145/32764792:OOPSLA(1-25)Online publication date: 24-Oct-2018

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media