River crossing problem

In section 5.6 of “The Little Book of Semaphores”, Allen Downey says this problem might have originally come from Anthony Joseph at U.C. Berkeley: Somewhere near Redmond, Washington there is a rowboat that is used by both Linux hackers and Microsoft employees (serfs)...

Building H₂O

In section 5.5 of “The Little Book of Semaphores” the following is called “building H₂O”: There are two kinds of threads, oxygen and hydrogen. In order to assemble these threads into water molecules, we have to create a barrier that makes each thread wa...

The Santa Claus problem

“The Little Book of Semaphores” presents the following as the “Santa Claus problem”, and attributes it to William Stallings: Stand Claus sleeps in his shop at the North Pole and can only be awakened by either (1) all nine reindeer being back from their va...

How to succeed at infrastructure automation

Hilzer's barbershop

Last time I wrote about the “Barbershop problem” from the “The Little Book of Semaphores”. Ian Dawes pointed out that the solution I presented can be further simplified: instead of having a gorotine dedicated to arbitrating the waitroom, make the channel b...

Optimize Go binary size

~21MB Well, I found yesterday that LogPacker Daemon weights about 21MB. This application is written in Go language, it’s really doing a lot of things, has built-in connectors to different Data-Storages, has Cluster solution inside, etc.

Working with Redis

In this post I'm going to be looking at using Redis as a data persistence layer for a Go application. We'll start by explaining a few of the essential concepts, and then build a working web application which highlights some techniques for using Redis in a concurrency-safe way....

Chaos Engineering: A Shift in Mindset

The barbershop problem

The second problem in the “Less classical problems” chapter of the “The Little Book of Semaphores” is called “the barbershop problem”. It as originally proposed by Dijkstra as “the sleeping barber” program. The book presents the pro...

Flag-oriented Programming

booleans, am I right? What a wonderful piece of technology! They help us solve so many problems… I just need this method to behave slightly different when some condition is true. Nice, what’s the problem in that? We had a method like this: class Coffee...