Jakub Godawa

Talk: Visualized multi-threaded simulators in Ruby

I like Ruby and Ruby likes me. I'm a nerdy team player and I enjoy pair-programming.

Visualized multi-threaded simulators in Ruby

We all do simulations in our heads, so why not make one in Ruby? Something that we can observe, fast forward, or let it linger. Let’s see how custom shared timers, threads, queues, and mutexes work together, and how they can form a petrol station with optimal cost and throughput.

The cars are coming to a station. They want to get some fuel. They come at different times and they need to be served. Just like web requests but this time we’ll not do web development. This we do at work. So for fun we want to build something that feels more alive. A small closed system that we could fully control and derive further ideas from. This is how we start thinking about simulators.

The main idea of a simulation is that it happens in some programmable environment. First, we need to think about how to control time. If every piece of the simulation, like a car or a station, runs in its own thread, then how do we synchronize them? How to handle access into shared resources? What data structures should we use?

Also, how do we create a protocol for gathering results to help us make decisions? How do we write a config file for a simulator engine that can spawn multiple scenarios in parallel? And last but not least, how do we visualize a simulation?

This presentation is a pure Ruby feast. We will operate on MRI and visualize the simulation in two ways: with d3.js, and through ASCII art. See you there! 🚕

Bio

My name is Jakub. I come from Poland, and I’m 38 years old. I’ve been enjoying programming for over 20 years now. Throughout my career, I’ve experienced a couple of burnouts, but I’m hopeful that I have recovered from them. Outside of programming, I am passionate about studying acting, psychology, and Indian philosophy. Writing prose is another passion of mine, and I also practice boxing regularly. For the majority of my career, I have been involved in full-stack development, whether it be within a company, independently, or managing a small team. My interest in computer simulators was inherited from my dad and further developed through Arduino projects with my uncle.