Computer Tech.: Lecture three

I wasn’t even in this lecture, so this material is new to me. The fetch/execute cycle isn’t though.

Fetch/Execute Cycle

Made in a presentation owned by De Montfort University, copyright them.

Made in a presentation owned by De Montfort University, copyright them.

Basically, what this is showing how program instructions are used by the processor. First of all, when you load an application most of the instructions will be loaded into RAM. From there, RAM fetches the first line, and sends it to the control unit, which decodes the instructions, making them more readable by the machine. That formatted data is passed to the ALU which can make changes with it and actually execute the code. Any output is then stored, and the next line of code is taken from RAM.

This shows the flow of data. (Also created by DMU.)

This shows the flow of data. (Also created by and copyright DMU.)

There’s also a type of cycle between the processor and main memory. The processor needs to request a piece of memory, and then it’s delivered. How it’s delivered is important here though. The processor uses a bus – which is a high speed connection – known as the address bus to ask for the data in that sector. Then the RAM (usually) sends that data back over a data bus.

Processors need to work things out fast, like… yesterday. That means even the short distance between the onboard cache to the processor is too far. To fix that, processors have registers built into them, known as special purpose registers. Just like cache though, they hold lines of code and other data.

The sequence control register (SCR) holds the memory location of the next line of code that needs to be fetched, so as soon as it’s needed it can be requested over the address bus. That’s an alternative to the processor having to work out where the next line of code is, considerably speeding things up.

The current instruction register (CIR) holds the next instruction to be processed. There are others too, take a look through the presentation.

We write pretty simple things in Visual Basic in a few lines, like storing two variables and then adding them together, and putting them in a new variable. That could take three or four lines, however when that gets translated into machine code that the hardware can “read” it may turn into ten or twenty lines. That’s because there are so few machine code instructions (in order to speed up the processes, like I talked about in the last presentation).

Go read slides nine to eleven yourself… they’re a bit heavy.

Measuring Speeds

That cycle runs on a regular basis, and doesn’t start again just because the cycle has finished. The processor may in fact just be sitting around not calculating anything for a nanosecond or two every once in a while. That’s because the cycle is began when the onboard clock “ticks”.

There’s a quartz clock on your motherboard which keeps track of the time between processes. It’s even possible to speed up the clock – which is known as overclocking. You can drastically increase how fast your processor is by overclock, but the huge danger is that the processor will work so much hard that it’ll produce far too much heat and eventually burn its self, literally melting inside your computer. Because of that, if you overclock you immediately void your warranty most of the time.

The speed of your clock is measured in hertz. Your current computer is probably around 1GHz or something. A hertz would be one cycle every second, so in my 1.86GHz laptop, there’s going to be around 1.86 billion (1,860,000,000) calculations every second. If you watch your CPU usage though (control + alt + delete, on the performance tab), you’ll probably notice it rarely goes above 20%. (If it does constantly, you have something wrong with your machine.)

However, don’t get pulled into the trap of thinking you can use the GHz to compare two processors with a different instruction set. Each “tick” will process one instruction, but some processors have complex instruction sets, and some have simple instruction sets so it could take a complex instruction set one tick to complete an operation, where it could take twenty ticks for a simple instruction set processor to complete. So even if it has a higher GHz count, it doesn’t mean it’s faster.

To overcome that problem, people decided to start using MIPS. Now we can count the average number of instructions the processor can make rather than the number of ticks. That can still be misleading though, since it’s only an average.

Measuring the speed of your processor is actually rather stupid. They’re stupidly fast, we know that. That’s good, but only if your other hardware can handle it. What’s the point of having a processor that can process a billion instructions a second when your RAM can only pass it twenty-million per second? Increasing processor speed in that situation would be useless.

Other Architectural Aspects

So, caching is used to store information when finding it on the hard drive or compiling it again and again is just a waste. A fairly good hard drive these days can read data at about 1Gb/s. Remembering that our processor can do more than a billion processes a second, if we were storing our next instruction on a hard drive the processor would be waiting for a hell of a long time (in computing terms) for the next instruction. That’s why we store the next instruction in cache on the processor, which has a read speed which is a hell of a lot faster.

The cache in the processor is usually about 32Kb, if you’re lucky, and is called primary cache. Secondary cache didn’t used to be, but it’s now also inside the processor, with about a megabyte of memory. Disk cache is basically your RAM, which you probably have about 2Gb.

Like I mentioned before, your processor probably isn’t using it’s full potential so designers decided to make it so instructions can be pipelined. That basically means that the processor works on more than one instruction at the same time.

Slides 22 to 28 are about different types of RAM… You know what RAM is though, right? Volatile, but really fast storage for the processor to access.

The rest of the slides are just photos of what a motherboard looks like. If you’ve never seen one before, you’re on the wrong course.

Comments are closed.