Weekly notes #3

Ruby, systems, performance, and programming links from last week.

Object ID in MRI - Aaron explains how objects are allocated in Ruby (they’re aligned on 40 byte boundaries), tagged pointers (the scheme is here), and how to find out the address and an arena in which the object is located, given its object_id.

Nil is not NULL and other tales - the article above and a discussion with Martin Vidner brought me to this article. This part is especially interesting. Perhaps we could develop something similar in MRI?:

If the least significant five bits of a pointer match that value, the value is considered by Rubinus to be nil. In the past, we have only ever used that precise value. In other words, all the other bits are zero. But nothing requires this, and those other bits don’t need to be wasted. When a method returns nil and that nil is not a value that was propagated from a value passed to the method, we can return a nil that is tagged for that specific method. The value behaves exactly as nil, when nil was a singleton value. But now we can find the source of the nil when we encounter it later. We can trace various paths of specific nils through code and help the developer understand why a particular value is nil.

The Tragedy of Maybe and Ruby - A different perspective on the problem of nils. Maybe type and how it would probably not work in Ruby as it cannot be effectively used without a robust type checker.

How is a binary executable organized? Let's explore it! - uprobes require function addresses to be registered.

How debuggers work - Parts 1, 2, 3. Mostly using ptrace. And ACME duct tape. The last part covers debugging info and the DWARF format - the article about objdump above lead me here.

Leaky bucket - Wikipedia - a rate limiting algorithm. Shopify described its use in Surviving Flashes of High-Write Traffic Using Scriptable Load Balancer.

Replicated Data Consistency Explained Through Baseball - a paper from Microsoft.

Videos

Metrics, Metrics, Everywhere - an older talk from Coda Hale. How metrics lead to better business and programming decisions. I suppose the tool he described eventually evolved into systems like Prometheus? Or was it the other way around? :)

Tools

FredKSchott/CoVim: Collaborative Editing for Vim - Collaborative Vim. Yay!

Snaps - universal Linux packages.