Blender Fox


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.

The Top Programming Languages, Ranked by Job Demand, Popularity, More

#

Apparently, the most sought after language is Java. Not that surprising considering it powers quite a few things, including Android and anything running Android (well, to a point, I guess since it doesn't run Java in the same way that you would run the JVM on, say, your desktop.) Still, gives me a reason to brush up on it. And perhaps work towards a Java certification. I did have J2CP, but that was years ago, so I'm not sure if it is even valid any more.

Although it surprises me a little that Ruby and Perl aren't on this list.

The Top Programming Languages, Ranked by Job Demand, Popularity, More.

Java

#

Duke, the Java Mascot, in the waving pose. Duk...

I really need to pick up and freshen up my Java knowledge. The last time I seriously programmed in it, we had no generic types, no lambda expressions, the Collections framework was not actively in use, and the dynamic object type of choice was Vector.