Monday, January 19, 2015

Inc CPU Part 1

If we disclude price when it comes to CPU’s there are a few factors that play a fairly important role- Processor clock speed, number of cores available,  supporting motherboards for the CPU socket, supported RAM, and finally consistency as well as stability.  

Ultimately the CPU is the brain and a system should be designed around it.  

While I will briefly go over how CPU’s work - for anyone more curious than the details provided I recommend reading the microprocessor article on how stuff works:  http://computer.howstuffworks.com/microprocessor.htm

Keep in mind that what I’m about to say is grossly over simplified. We have a single core processor.  The processor basically takes in logical problems and provides results.  Example:

We have a single core processor that adds two numbers and replies with their sum.  The only thing this processor does is adds two numbers and provides the sum.

So we send it instructions to add these numbers together:
1 + 2
3 + 6
7 + 2

It first take 1 + 2 and replies with 3
Next 3 + 6 and replies 9
and finally 7 + 2 and replies 9

So let’s say we have an instruction set of 1 billion additions that needs to happen.  In reality modern processors could handle this very quickly, but let’s say it takes 30 seconds per each addition instruction line.  That is a pretty long time and we really don’t want to wait that long for all those sums.  So how do we reduce the time it takes per instruction line?  We increase the clock speed!  Clock speed for modern processors is usually measured in Gigahertz(GHz).  The higher this number is the faster single lines of instructions are processed.  But wait there is more - most modern processors have more than one core!  So while we might be processing 1 billion instructions we also are not limited to a single core to do all the work!

There is just one drawback - let’s say our processors still only add, but it can add any amount of numbers in an instruction line. And let’s say our clock speed is the same for both - however in order to process two numbers it takes 1 cycle of the clock speed.

So we give it:
1 + 2
1 + 1 + 2 + 1 + 2 + 5
2 + 3
5 + 2

And now we have two cores within the processor:

(Clock Cycle 1)
Core 1 processes 1 + 2  (Replies 3)
(At the same time) Core 2 processes 1 + 1 + 2 + 1 + 2 + 5

(Clock Cycle 2)
(First cycle replaced 1 + 2 with 2)  Core 2 processes 2 + 2 + 1 + 2 + 5
Core 1 processes 2 + 3 (Replies 5)

(Clock Cycle 3)
Core 2 processes 4 + 1 + 2 + 5
Core 1 processes 5 + 2 (Replies 7)

(Clock Cycle 4)
Core 2 processes 5 + 2 + 5
Core 1 processes nothing (Notice that it cannot help core 2 out despite there still being extra info to process)

(Clock Cycle 5)
Core 2 processes 7 + 5 (Replies 12)
Core 1 processes nothing

Despite having two cores only one core is given access to an instruction line.  Unfortunately the developers are the ones who determine what an instruction line includes.  Thus having more cores isn’t always better when trying to process data.  

With that being said in the next article we'll look at a few CPU’s available on the market -

No comments:

Post a Comment