March 14, 2020
i woke up the other day and went downstairs just in time for the coffee to finish brewing.
i poured a cup, read my email and checked the 10 day weather forecast.
It was going to rain for the next 10 days starting that night.
My shed needs a rain gutter to avoid erosion on the ground at the eave end of the roof pitch.
i got dressed and drove into town.
On the way to Lowes i stopped at the post office to pick up some mail just as the postmaster was unlocking the door.
At Lowes i bought all the parts for the gutter. i cleaned them out of hangers which had been stocked just-in-time for my purchase.
On the way home i got a text telling me my prescription was ready. CVS was 2 minutes ahead on my right. i picked it up.
When i arrived home i spent the day laying out and installing the gutter on my shed.
Timing is everything.
My timing is nothing compared to that of a computer.
Computers run according to the tick of a clock.
A computer clock is a chip with a crystal that vibrates at a specific frequency.
Think of the computer clock as ticking and tocking.
On the tick one or more read/writes occur.
On the tock the CPU performs one or more calculations.
Since my computer can perform 117 billion operations per second (117,160 MIPS at 3.4 GHz) it can process 34 instructions per clock tick.
The following descriptions and example are from “But How Do It Know” by J. Clark Scott.
Reading data and performing instructions in a computer is no small feat of timing.
To Read data:
CPU sends an address to RAM and power to the enable wire.
RAM sends the data at that address to the CPU.
Some examples of instructions are LOAD, ADD, STORE, COMPARE, JUMP IF, JUMP, OUT and IN.
A example of a simplified program to guess a number is:
COMPARE (is keyboard input equal to 9)
JUMP IF =
10100001 (Where OUT, Monitor (address),
“Y”, “E”, “S” are executed)
The address of IN above
Because read/writes occur on the tick and calculation occurs on the tock this program takes several clock cycles to run. The CPU is not idle, however. It uses all those ticks and tocks to keep processing everything else that is going on in the computer. Besides… the program has to wait for the human’s guess.
With all this processing going on, control is required. A timing and control circuit assures that the next operations can be performed within the next clock cycle so that calculations don’t crash into read/writes.
— Garrett Hedlund