Seven Concurrency Models in Seven Weeks; Working with Ruby Threads
September 25, 2013
On this day in 1906, Leonardo Quevedo demonstrated a radio-controlled robot that drove a boat around the harbor. Remote control was easier back then, as there was only one remote-controlled robot in all the world. But once you get thousands or millions of them trying to work together and cooperate, the game gets a lot tougher.
And that's where we are now: facing new challenges trying to work with thousands or millions of processes across multiple cores, handling thousands of users and terabytes of data, with little to no down time. For new challenges, you need new techniques: Seven Concurrency Models in Seven Weeks: When Threads Unravel, now in beta from pragprog.com/book/pb7con.
For a more introductory look at threads, and specifically in a Ruby or Ruby on Rails environment, start with Working with Ruby Threads, now available from pragprog.com/book/jsthreads.
After all, if you don't threading understand results different may get unexpected you ;)
Seven Concurrency Models in Seven Weeks: When Threads Unravel
This book will show you how to exploit different parallel architectures to improve your code's performance, scalability, and resilience.
Learn about the perils of traditional threads-and-locks programming and how to overcome them through careful design and by working with the standard library. See how actors enable software running on geographically distributed computers to collaborate, handle failure, and create systems that stay up 24/7/365. Understand why shared mutable state is the enemy of robust concurrent code, and see how functional programming together with technologies such as Software Transactional Memory (STM) and automatic parallelism help you tame it.
You'll learn about the untapped potential within every GPU and how GPGPU software can unleash it. You'll see how to use MapReduce to harness massive clusters to solve previously intractable problems, and how, in concert with Stream Processing, big data can be tamed.
With an understanding of the strengths and weaknesses of each of the different models and hardware architectures, you'll be empowered to tackle any problem with confidence.
Now available in beta from pragprog.com/book/pb7con.
Working with Ruby Threads
Working with Ruby Threads starts with an introduction to how threading works at a high level, showing you what your Ruby programs look like with multiple threads at play. You'll learn about things such as context switching and race conditions.
From there, you'll get a safari tour of Ruby's Thread API, followed by a deep dive into the infamous GIL: its effects, its implementation, and the reason it's there. Next you'll look at JRuby and Rubinius, how they don't have a GIL, and how this affects multi-threaded code when run on those implementations.
The middle section of the book is all about thread safety: what it means, what it looks like, how to write thread-safe code, how to recognize thread-dangerous code, and what options Ruby provides for writing correct concurrent programs. You'll then look at abstractions on top of threads (such as Actors), and wrap up by walking through some real-world, multi-threaded code. You'll get to see examples from the Puma web server, and one from the Celluloid-based Sidekiq project, bit by bit with explanations along the way. Two appendices take you into advanced topics such as immutability and compare-and-swap operations.
After all this, you'll have a good handle on multi-threaded concurrency, and you won't be afraid to apply it to your next Ruby project.
Now available from pragprog.com/book/jsthreads.
Did You Know?
We're moving away from OpenID. If you're currently using OpenID to login to pragprog.com, please set a password with us directly instead. We'll be turning off OpenID support on January 1st, 2014. Thanks!
Upcoming Author Appearances
Don't Get Left Out
Are your friends jealous that you get these spiffy email newsletters and they don't? Clue them in that all they need to do is create an account on pragprog.com (email address and password is all it takes) and select the checkbox to receive newsletters.
Are you following us on Twitter and/or Facebook? Here's where you can find us and keep up with the latest news and commentary, and occasional discounts:
- Agile Web Development with Rails 4 (in print)
- Programming Erlang, 2nd Ed (in print)
- The Dream Team Nightmare: An Agile Adventure
- iPad and iPhone Kung Fu
- The Retrospective Handbook
- Practical Programming: An Introduction to Computer Science Using Python 3
- Programming Sound with Pure Data
- Web Development with Clojure
Thanks for your continued support,
Dave & Andy
The Pragmatic Programmers
Books • eBooks • PragPub Magazine • Audiobooks and Screencasts