Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
http://rubykaigi.org/2016/presentations/pitr_ch.html There is a hidden problem waiting as Ruby becomes 3x faster and starts to support parallel computation - reordering by JIT compilers and CPUs. In this talk, we’ll start by trying to optimize a few simple Ruby snippets. We’ll play the role of a JIT and a CPU and order operations as the rules of the system allow. Then we add a second thread to the snippets and watch it as it breaks horribly. In the second part, we’ll fix the unwanted reorderings by introducing a memory model to Ruby. We’ll discuss in detail how it fixes the snippets and how it can be used to write faster code for parallel execution. Petr Chalupa / @pitr_ch He is a core maintainer of concurrent-ruby, where he has contributed concurrent abstractions and a synchronisation layer, providing volatile and atomic instance variables. He is part of the team working on JRuby+Truffle Ruby implementation at Oracle Labs. He is a happy Ruby user for 10 years.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the video titled 'Who reordered my code?!', Petr Chalupa, a core maintainer of concurrent-ruby, discusses the challenges posed by code reordering in the context of Ruby's performance improvements and parallel execution capabilities. The talk highlights the implications of Just-In-Time (JIT) compilation and speculative optimizations that can disrupt the expected behavior of concurrent code. Chalupa begins with an introduction to Dekker's algorithm, illustrating how it manages critical sections between threads. He demonstrates the algorithm functioning correctly without JIT compilation but failing when executed with optimization enabled, emphasizing the unforeseen consequences of code reordering. Key Points Discussed Throughout the Video: - **Performance Goals for Ruby**: The aim is to make Ruby three times faster with the introduction of JIT compilation and improved parallel execution to leverage modern multi-core processors. - **Reordering Issues**: Two main sources of reordering are identified: - Compiler optimizations that process code as single-threaded. - The processor's execution of instructions, which can complicate the intended order of operations. - **Memory Models**: The importance of establishing effective memory models for shared variables is discussed. This allows programmers to define certain variables as shared, ensuring that their updates are consistent and recognizable across threads. - **Sequential Consistency**: The concept of sequential consistency is introduced to aid in reasoning and understanding the interactions of shared variables logically. It ensures that all thread operations conform to a specific execution order. - **Practical Implications**: Chalupa discusses the relevance of these principles in developing robust libraries, data structures, and concurrency tools, emphasizing that programmers should rely on existing libraries like concurrent-ruby rather than building new solutions from scratch. In conclusion, the talk underscores the need for a solid memory model in Ruby that supports concurrent execution while maintaining performance. The insights presented indicate that with the right frameworks and understanding of concurrency, Ruby can flourish in high-performance environments, thereby inviting developers to think critically about their code's execution order and shared variable management. Chalupa rounds off the presentation by inviting further questions, indicating a responsive and engaging approach to complex topics in concurrency programming.
Suggest modifications
Cancel