Stuck inside on a rainy day...

Posted by Astryl on Aug. 31, 2012, 6:16 a.m.

Due to some unforeseen circumstances that don't make any logical sense but happened anyway, the four branches of the store I work for, all owned by one franchisee, are short four people today. So here I am in the store in Saldhana, with practically nothing going on. Because of this, and since I have now read every freakin' halfway decent story on FIMFiction (and stopped myself from descending into that mess too far), I decided that it was time to write a blog… On this accursed iPad.

So, how about I talk a bit about the way the CPU works, how it executes code, and how it controls external devices? Interested? Good.

This will be a long blog, unless I miraculously get a troop of people wanting to buy water on one of the rainier days I've seen in a few weeks.

The CPU

Possibly one of the most misunderstood pieces of hardware in the system. I frequently find myself wanting to punch somebody when they ask how 'fast' a processor is, and gawk like idiots without understanding what the implications of the 'speed' are.

Another delusion is that it is a single piece of hardware. It's actually a self contained system, containing several unique components.

Among these exist the System Clock, the data bus, an instruction fetcher, an execution module (which is a wonderfully complex gathering of logic gates), an interrupt line (often connected to an external PIC, or Programmable Interrupt Controller), an APU (Arithmetic Processing Unit), an internal cache, and a few hardware registers.

The CPU's job is very simple in theory: it fetches the next instruction from the data bus, executes it, and repeats the cycle.

More realistically, the CPU can also receive 'interrupts', hardware induced triggers that usually make the CPU save its state and execute a special handler defined by the Resident OS.

The number of instructions a CPU can execute per second is the commonly referred to 'speed'. One megahertz is equivalent to 1,000,000 instructions per second. One Gigahertz is equivalent to 1,000,000,000 instructions per second. Got it?

Of course, here's where trouble sets in. The CPU is extremely fast. The RAM, on the other hand, is not. RAM is also locked to a specific frequency, relating to the number of fetch requests that can be handled per second, also described in MHz or GHz. On most budget RAM modules, the frequency is much lower than the CPU's potential request frequency.

I'll expand on this shortly.

Update

I'm too demotivated at the moment to continue this; ask questions, that'll probably get me going again.

Just a few interesting things I failed to mention in my last few blogs: I finally got myself a proper headset (With a decent microphone and bass amplification. Heck yeah!).

Then I bought myself Just Cause. And I'm finding it absolutely hilarious and from here on in I decree that any game with vehicle based combat ought to allow you to jump out onto the front of the vehicle and parachute off, or grapple with the traffic… Heheh.

Just try to imagine Unreal Tournament with players able to hitch rides like that… sniper heaven.

Also, I just realized yesterday that I can afford to upgrade my PC. Which I might be doing next Saturday/Sunday. At the same time, I'm brute forcing my whole internet problem by doing the logically simple: Buy 30 meters of CAT3 cable, run it from my PC to the family router. Problem solved. >:{

Well. I'll get back to (not) selling water. Very few customers on a cloudy Saturday…

Comments

Rob 12 years ago

Quote:
There's the problem; it may or may not make the system faster. One of the primary reasons I haven't bothered upgrading my PC yet is that getting a Core i3/5 with my current setup will be no faster than the system I already have, because the RAM is the bottleneck (Cheap DDR2 modules, noname brand.)

You can get 8gb of DDR3 for <$40 right now….

But, wait, you'd need a new motherboard for that. But you'd need that anyways to get a i3/i5 anyways since you've probably got a LGA775 or AM2 or whatever socket board, not 1156/1155/etc, so I don't see the point in saying that anyways.

Quote:
On most budget RAM modules, the frequency is much lower than the CPU's potential request frequency.

This is true for every single RAM module I've ever seen. We don't have 3-4ghz RAM. The most I've seen is OCing to like 2200 or so. Isn't there this lovely thing called cache for this purpose though?

Astryl 12 years ago

Fair enough.

I give up; I am most definitely not studying the hardware of the PC, only the abstract side that applies to the programming I do. On a very low level, actually, because of the OS development related activity.