Spectre and Meltdown

If you qdo not believe that understanding how a modern computer works, you need a wake up call. The hottest topic on the Web today is the ``Spectre and Meltdown` bugs in modern computer chips. (see this link for more details.)

The architecture of the computer begins as a very simple arrangement of very simple parts. Those parts worked at incredible speed, and in the end, we were happy with what we managed ot get our computers to do.

However, lust as happened with the automobile, we humans demanded more out of our machines. Specifically, we wanted them to go faster! It was not enough to get somewhere faster than we could when riding a horse. We needed to get there NOW! So engineers worked to make our cars faster and faster.

Note

Ever driven on the “Supersonic Highway”? (That is my name for Texas 130 from Austin down toward San Antonio. The speed limit is 85! I have nbeen passed on that road by folks in fancy cars (and motorcycles) doing far more than that!)

Making Computers Faster

The designers of the computer chips we all use on a daily basis have been suffering from the same drive for speed. That has been going on for decades. Todays, what started out as a simple machine running in a simple cycle has morphed into a machine doing everything conceivable (and even a few things you might never have expected) in the drive for speed.

The result has been an unexpected shockwave in the industry.

iTiming Tasks

Say you have a task you need to do as fast as possible. Let’s make this task simple. You have a stack of cards on your desk, each with two numbers written on them. Your task is to produce the sum of each pair of numbers on a single card, then you need to add up all of those sums to get a final answer.

This does not sound so hard. You grab your calculator and sit down to go to work. How long will it take?

Since the real time is not imprtant, lets simplify our timing analysis by saying that the it takes one unit of time to add any two numbers. How many additions do we need to do?

Let’s see, we have 100 pairs of numbers we need to add, so that takes 100 units of time. Then we need to add all of thiose numbers together. That will take 99 more units of time to get to the final answer. (Make sure you believe that!)

Total time? 199 units.

Speeding things up

Can we go faster? Sure.

Invite a friend, who also has a calculator, to help. You will still do all of the initial adding. But your friend will handle getting the final answer. You start off by doing your first addition and producing your first. Your froend can start work now, but with only one number, there is nothing to add. Unless we say that your friend starts off with a zero, then adds in your first number. Fine, we have consumed one units of time, and we already have a partial final result. IN that one unit of time, we actually did two additions. Makes sense, we had two calculators available, and two means of doing work in that single unit of time.

Now the entire task will take only 100 units of time to complete. Hey that is faster!

Parallel Procesing

This simple example is a good introduction to parallel processing. Some folks call this “multi-tasking”. Same idea, different terminology!

More Speed, please!

Suppose you have two more friends with calculators. Can we do even better?

Sure. Just split up the pile of cards into two stacks, and set up two teams of two friends each to do the smaller job. WIth 50 cards in front of each team, we will finish each smaller job in 50 units of time. Wait, we still need the final result, add one more unit of time to add the two final numbers procuded by each team.

Total time: 51 units of time. Now we are up to almost four times as fast.

You can keep doing this silly task with more friends, until you run out of names on your Facebook Page!

Out of Order

Is there any reason why we have to add all the numbers together in a certain order? Not really in this example. Every pair is unique, and independent from every other pair. Even adding up the final answer is not dependent of any prder, a fact you should understand if you know the rules of matheamtics for addition:

A + B + C = A + C + B

Monkey Wrench Time

Now, let’s introduce a tiny wrinkle in the process:

If any initial sum of the two numbers on any card is greater than 100, you throw that result out, and do not include it in the final answer. Great! Now what do we do with our time calculations.

Well we need to test each sum produced, and see if it is greater than 100. If it is, we toss is and our second friend will not do an addition. Let’s again keep our timing calculations simple, by again saying it takes one unit of time to do this comparison.

Now suppose that each of those 99 friends had a calculator that worked at different speeds. SOme came in with paper and pencil in hand, and would do the job like in grade school. Others jjust looked at the numbers and wrote doen the answer (really?) Others punched the numbers into a mechanical adding machine and read the answer off of the machine after pulling on a lever. WHat would this do to the overall task.

Well some would finish sooner than others. We would have to wait for the slowest friend in the pack before we could declare the jb done. Obviously, the results would appear in a seemingly random order.