Two Generals

It’s been a long while since I posted anything of interest other than fitness and running, so here’s something I found that isn’t fitness related.

Tom Scott (Twitter: @tomscott) posted this video about the Two Generals problem. Basically it centres around two generals and asks how they can synchronise communication to ensure they two something at the same time.

In multithreading computing, including back when I was learning Java, we had a synchronized keyword which ensure only one thread went through a block of text. But here, you want two threads to proceed at the same time. How do you ensure that? Turns out there’s no guaranteed way.

Even TCP requires a 3-way handshake aka the SYN, SYN-ACK, ACK (https://www.inetdaemon.com/tutorials/internet/tcp/3-way_handshake.shtml), but if any of those messages drops, the connection never establishes.

Of course you could just use the UDP method of “fire-and-forget” and say “Hey, General B, we’re going to attack at 8pm, catch up if you have to”, and have dropped packets (or casualties in the two generals problem)

This is an interesting thought experiment and one I hadn’t considered during my time learning parallel and threaded programming.

Oh well, you learn something new every day, I guess.

Training 3rd August 2019

Went running today, made one lap around my local park pretty comfortably, but my left ankle started to hurt. The same ankle I had a fractured metatarsal on a few years back. Here’s hoping it isn’t serious.

A few hours later it’s eased up, since I’m not putting pressure on it.

I wonder if maybe the cushioning on my shoes aren’t up to par now. Maybe I need to gait test again.

Today’s run, since I’m no longer using Endomondo’s training runs, I did the lap using a constant run, average pace was around 6:07 min/km.

Training – 28th July 2019

After a stupidly long time without running, I’m back at it. Did a lap of the park and I utilised a new app on my FitBit watch, which lets you set a target time and distance and gives you a running “partner” running at that pace to run against. So in this picture, I’m 22 seconds ahead of my running partner. We are both standing still as I stopped to take this picture.

What is neat about it is that once you finish, you can set save your finish time for next time to try to beat it.

Also, while running, I spotted a rusty old BlackBerry that was lying around

Looks like it belongs to Barnet Council…