It is SREcon time again! This iteration takes places in beautiful Singapore! 🌴I flew in yesterday in a half-empty A380. First time A380 (amazing piece of engineering!), first time visiting Asia. It’s also the first time I’m staying in the same hotel where the conference I’m attending takes place. Not the first time I’m investing my savings into getting up to speed with a new role, but maybe the first time I was very generous to myself.
My first exposure to the UNIX shell was when I was being told that I have to share access to the Internet with my younger siblings. Not keen on turning my computer into a time-sharing station, I had to build my first router. My dad worked in telecommunications and made sure every kid had an own landline phone and a PC in the room. But he wanted us to share a single Internet dial-up to save money.
Earlier this week I found myself discussing UNIX process states with my colleague Michael. When it came to orphaned processes and daemonizing I vaguely remembered that I had to fork() twice to get a daemon process. That statement was immediately challenged by Michael. Rightfully so, because forking twice is not the key action here. The missing piece was to obtain a new session between the first and the second forking.
In today’s article, we will implement a simple, unbalanced, concurrency-safe binary search tree in Golang. We will use some nice patterns along the way that are worth knowing.
I assume that the valued reader has a basic understanding of the Go programming language and knows what a binary search tree is. What I want to show is how easy it is to create a concurrency-safe version of this basic data structure in Golang.
Once I heard about an abandoned World War II-era anti-aircraft platform that sits in the North Sea and hosts a self-proclaimed micronation called Principality of Sealand. One can hardly spot it on Google Maps, this is how micro it really is.
Here is an aerial shot of Sealand by Ryan Lackey:
Back then I was fascinated by the history of the platform and thought it was quite funny to establish a nation in the middle of nowhere.