Get the latest tech news

Ruby methods are colorless


👋🏼 This is part of series on concurrency, parallelism and asynchronous programming in Ruby. It’s a deep dive, so it’s divided into 10 main parts: Your Ruby programs are always multi-threaded: Part 1 Your Ruby programs are always multi-threaded: Part 2 Consistent, request-local state Ruby methods are colorless Concurrent, colorless Ruby: Part 1, Threads Concurrent, colorless Ruby: Part 2, Fiber and its MaNy friends Parallel Ruby: Processes, Ractors and alternative runtimes Streaming Ruby: Scaling concurrency Abstracted, concurrent Ruby Closing thoughts, kicking the tires and tangents How I dive into CRuby concurrency You’re reading “Ruby methods are colorless”.

Every program on every common operating system (Linux, Windows, macOS) runs inside a process - it’s the top-level unit of execution in the OS. Multiple Ractors can run Ruby code in parallel, and they have strict sharing rules to keep them memory safe - so you can only communicate between them by passing messages. Every time one of your job or web server threads/fibers reads a file, queries a database, makes an HTTP call, or waits for a shared resource, Ruby parks the thread/fiber and another thread/fiber is able to take over.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Colorless

Colorless

Photo of Ruby Methods

Ruby Methods