Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Samdb

How a CPU works

Recommended Posts

Posted · Original PosterOP

How a CPU works


CPUs are known by several different names, including Central Processing Unit, Processor and Microprocessors. These CPUs process data depending on the program that you are currently using, however it doesn't make a difference for the CPU as various compilers and translators following instructions declared by the programmer.


In the past the CPU would handle data moving from the hard drive to the RAM, however in recent years CPU speeds have far exceeded the speeds of hard drives and would slow today's systems down exponentially. Direct Memory Access is now used to allow the transfer of data without a CPU.


Older processors on AMDs 754, 939 and 940 sockets have an embedded memory controller which allows the CPU to directly access the RAM, bypassing the north bridge chip.


CPU Clocks

The clock signal is a binary signal, meaning that it is either high or low, 1 or 0, on or off.

 

IoxlQDq.jpg

 

A Clock Signal

 

All things a computer can do is measured in clock signals. This is prevalent in CAS Latency, where the Latency of the RAM often dictates the responsiveness of said RAM. For example CAS9 would take 9 clock cycles in order to being retrieving data, if the CAS latency of RAM is too high a computer might start to fall behind in terms of responsiveness.


CPUs construct tables in order to know what instruction is next to be executed therefore the CPU will not be waiting for an instruction for an increased length of time as the current instruction may take several cycles in order to complete, allowing the CPU to execute multiple instructions at the same time, however only completing one instruction at a time. Modern CPUs have superscalar architecture, allowing them to execute multiple instruction at a time due to the several execution units working in parallel.


Many questions arise when Intel and AMD are compared, however they both perform to the same degree with varying clock speeds, IPC (Instructions Per Clock) and the amount of cores. Processor "X" may take 7 cycles in order to complete and instruction, however processor "Y" may take 9 cycles in order to complete the same instruction. However Processor "Y" may have more cores than processor "X", meaning that the amount of cycles needed to complete the given instruction is essentially the same as processor "Y" but it less efficient and makes up for this inefficiency by having more physical cores in order to complete the instruction.

 

Block Diagram of a CPU

Z2I2KJD.jpg

Above is a basic block diagram which should allow you to grasp the first things to know when it comes to CPU architecture. AMD and Intel CPUs will differ from this slightly, however both use a similar idea as to what you can see above. The RAM is not part of the CPU, however plays a key role and the diagram could not be complete without it. Everything below the RAM is located within the CPU itself, more accurately the internal clock and depending on the parts used the clock speed can either be higher or lower than initially intended.


Memory Cache

Memory cache or static memory is much faster that RAM, also known as dynamic memory. Despite being a lot faster than dynamic memory is more expensive, bigger and consumes more power but it can work at the same speed as the clock, making it invaluable as dynamic memory is much slower which could lead to lower overall performance.

Memory cache allows the CPU to work within itself and not have to fetch data from the RAM, meaning that the cache is a type of frequently used memory. Programs are very sequential and often have the next load of data in the position below the one that the CPU is currently working with due to the memory controller on the CPU itself and can be accessed by the CPUs internal clock rate.


Processing Instructions

The fetch unit retrieves the instructions from either the cache or the RAM and looks if the instruction required is in the L1 cache, if not it is stored in the L2 cache and if not it is loaded from the RAM.


When a PC powers on the caches are empty, however when an OS is loaded the caches soon start to fill up. These instructions are quickly executed by the CPU starting from the hard drive, then to the RAM and finally the internal cache. When the fetch unit retrieves the instruction the instruction is sent to the decode unit for decoding and execution.


The role of the decode unit is to figure out what the CPU should do with the given instruction. The ROM that exists inside the CPU has a set of code known as microcode which allows the decode unit to decode the instruction in a way that the CPU can use it. After the instruction is decoded it will be sent to the execute unit where the decoded instruction will be executed. On modern CPUs there are many execution units as mentioned previously.


While modern CPUs have multiple execution units they are often assigned to do individual tasks. An example of which is the FPU or Floating Point Unit and executes complex mathematical instructions such as encoding numbers with various floating points with a fixed number of significant digits. With all of these execution units there must be something to ensure the instructions are sent to the correct execution unit, this is the role of the dispatch or schedule unit.

 

For a long time CPUs have had a feature known as "pipeline" which allows the CPU to work with several different instructions at various stages, allowing for more than one instruction to be reading for decoding and execution at a time, decreasing the waiting period while an instruction is being decoded.


The Jasp Toolkit

The JASP Toolkit allows you to gain an understanding of a CPU with a more visual representation and can be very useful to a beginner looking to understand the inner workings of a CPU.

http://www.brittunculi.com/jasp/#download

Link to post
Share on other sites

Meh, not gonna read through this. Too complicated.'

But good job, it will be good for those who wants to bother reading through this.


Cpu: Intel core i5 4570 gpu: gtx 770 case: cm storm enforcer psu: xfx pro 550w motherboard: asus b85m-g ssd: samsung 120gb hdd: wd caviar blue 1tb ram: kingston hyperx blu 8gb 1600mhz mouse: razer deathadder monitor: some decent samsung 19" keyboard: CM Storm TK Blue

Link to post
Share on other sites

hmm intresting thanks sam 


If you tell a big enough lie and tell it frequently enough it will be believed.

-Adolf Hitler 

Link to post
Share on other sites

i didnt read all of that but i liked the post it probs took some time and hard work to do and i appreciate it :)


He is the hero this forum deserves but not the one it needs right now.So we'll hunt him because he can take it because he is not our hero he is a silent guardian 


a watchful protector A Dark Knight

Link to post
Share on other sites
Posted · Original PosterOP

Thanks for this awesome topic, now i know how CPU:s actually work :)

 

 

i didnt read all of that but i liked the post it probs took some time and hard work to do and i appreciate it :)

 

Glad I could help ^_^

Link to post
Share on other sites

 

How a CPU works

CPUs are known by several different names, including Central Processing Unit, Processor and Microprocessors. These CPUs process data depending on the program that you are currently using, however it doesn't make a difference for the CPU as various compilers and translators following instructions declared by the programmer.

In the past the CPU would handle data moving from the hard drive to the RAM, however in recent years CPU speeds have far exceeded the speeds of hard drives and would slow today's systems down exponentially. Direct Memory Access is now used to allow the transfer of data without a CPU.

Older processors on AMDs 754, 939 and 940 sockets have an embedded memory controller which allows the CPU to directly access the RAM, bypassing the north bridge chip.

CPU Clocks

The clock signal is a binary signal, meaning that it is either high or low, 1 or 0, on or off.

 

IoxlQDq.jpg

 

A Clock Signal

 

All things a computer can do is measured in clock signals. This is prevalent in CAS Latency, where the Latency of the RAM often dictates the responsiveness of said RAM. For example CAS9 would take 9 clock cycles in order to being retrieving data, if the CAS latency of RAM is too high a computer might start to fall behind in terms of responsiveness.

CPUs construct tables in order to know what instruction is next to be executed therefore the CPU will not be waiting for an instruction for an increased length of time as the current instruction may take several cycles in order to complete, allowing the CPU to execute multiple instructions at the same time, however only completing one instruction at a time. Modern CPUs have superscalar architecture, allowing them to execute multiple instruction at a time due to the several execution units working in parallel.

Many questions arise when Intel and AMD are compared, however they both perform to the same degree with varying clock speeds, IPC (Instructions Per Clock) and the amount of cores. Processor "X" may take 7 cycles in order to complete and instruction, however processor "Y" may take 9 cycles in order to complete the same instruction. However Processor "Y" may have more cores than processor "X", meaning that the amount of cycles needed to complete the given instruction is essentially the same as processor "Y" but it less efficient and makes up for this inefficiency by having more physical cores in order to complete the instruction.

 

Block Diagram of a CPU

Z2I2KJD.jpg

Above is a basic block diagram which should allow you to grasp the first things to know when it comes to CPU architecture. AMD and Intel CPUs will differ from this slightly, however both use a similar idea as to what you can see above. The RAM is not part of the CPU, however plays a key role and the diagram could not be complete without it. Everything below the RAM is located within the CPU itself, more accurately the internal clock and depending on the parts used the clock speed can either be higher or lower than initially intended.

Memory Cache

Memory cache or static memory is much faster that RAM, also known as dynamic memory. Despite being a lot faster than dynamic memory is more expensive, bigger and consumes more power but it can work at the same speed as the clock, making it invaluable as dynamic memory is much slower which could lead to lower overall performance.

Memory cache allows the CPU to work within itself and not have to fetch data from the RAM, meaning that the cache is a type of frequently used memory. Programs are very sequential and often have the next load of data in the position below the one that the CPU is currently working with due to the memory controller on the CPU itself and can be accessed by the CPUs internal clock rate.

Processing Instructions

The fetch unit retrieves the instructions from either the cache or the RAM and looks if the instruction required is in the L1 cache, if not it is stored in the L2 cache and if not it is loaded from the RAM.

When a PC powers on the caches are empty, however when an OS is loaded the caches soon start to fill up. These instructions are quickly executed by the CPU starting from the hard drive, then to the RAM and finally the internal cache. When the fetch unit retrieves the instruction the instruction is sent to the decode unit for decoding and execution.

The role of the decode unit is to figure out what the CPU should do with the given instruction. The ROM that exists inside the CPU has a set of code known as microcode which allows the decode unit to decode the instruction in a way that the CPU can use it. After the instruction is decoded it will be sent to the execute unit where the decoded instruction will be executed. On modern CPUs there are many execution units as mentioned previously.

While modern CPUs have multiple execution units they are often assigned to do individual tasks. An example of which is the FPU or Floating Point Unit and executes complex mathematical instructions such as encoding numbers with various floating points with a fixed number of significant digits. With all of these execution units there must be something to ensure the instructions are sent to the correct execution unit, this is the role of the dispatch or schedule unit.

 

For a long time CPUs have had a feature known as "pipeline" which allows the CPU to work with several different instructions at various stages, allowing for more than one instruction to be reading for decoding and execution at a time, decreasing the waiting period while an instruction is being decoded.

The Jasp Toolkit

The JASP Toolkit allows you to gain an understanding of a CPU with a more visual representation and can be very useful to a beginner looking to understand the inner workings of a CPU.

http://www.brittunculi.com/jasp/#download

 

Great post Sam.

Just a request/suggestion: Put each category in a spoiler. Yes, I know that it is not that big of a post, but it is a formatting thing. I personally prefer it myself. If you do not, that is fine. 

I have not read it yet, will do later (at work). 


† Christian Member †

For my pertinent links to guides, reviews, and anything similar, go here, and look under the spoiler labeled such. A brief history of Unix and it's relation to OS X by Builder.

 

 

Link to post
Share on other sites
Posted · Original PosterOP

Great post Sam.

Just a request/suggestion: Put each category in a spoiler. Yes, I know that it is not that big of a post, but it is a formatting thing. I personally prefer it myself. If you do not, that is fine. 

I have not read it yet, will do later (at work). 

 

I was thinking about it, but each section is needed as the last section would not make any sense without the first and second sections. Thanks for the suggestion though :)

Link to post
Share on other sites

I thought there were lots of tiny people holding 0's & 1's running around like crazy,  you really have spoiled it for me..... :(

 

 

 

PS Nice work sir....


Lian Li PC-V359WRX Micro-ATX Case | Intel 5960X Extreme 3.00GHz | ASRock Fatal1ty X99M KILLER | Crucial 32 GB 2666 DDR4 | Thermaltake NiC C5 | EVGA Supernova 1200W P2 | 2x 240GB OCZ Radeon R7 | 2x 256 GB Samsung 840 Series Pro | 2 X 120GB Samsung 840 EVO | 6x NF-F12’s | Place Holder GPU R9 290X |

Links Current 5960X Old FX9590

Link to post
Share on other sites

nice work



- teamspeak.ltt-unofficial.com

- teamspeak.ltt-unofficial.net

- teamschnitzel.ltt-unofficial.com

- teamschnitzel.ltt-unofficial.net



cpu: Intel sandybridge-E 3930k @ 4.2Ghz

cooler: corsair h100 @ full speed push-pull

motherboard: Asus Rampage IV Extreme

gpu: 2x EVGA GTX660's & 1x EVGA GTX980

ssd: 2x samsung 256GB 840 pro raid 0

ssd: 1x samsung 1TB 840 evo

hdd: WD green 3TB

hdd: Seagate Barracuda 1TB (st1000dm003)

hdd: Seagate Barracuda 1TB (st31000520as)

psu: corsair ax1200i

ram: 8x 4GB corsair platinum @1866mhz

case: coolermaster cosmos II

age: Do the math (summer 2012)

monitors Main: 8x LG 22EA53 1080p 60hz

monitor Extra: 1xiiyama prolite G2773Hs 1080p 120hz 27"

os: windows 7 pro (64-bit)

keyboard: logitech g19

mouse: corsair m60

 


Lenovo T550

 


RaspBerry pi webserver:

Status: Offline.

 

Nas:

StatusOffline.

 


PC straight to the modem/router/switch/DHCP-Server/... with a 20cm (+-8inch) cat6a patch cable because same price as cat5.

ISP: Telenet (belgium)

Speed: 60Down-4Up (+- 45€/month)

ping to there servers: +-8ms

ping to other Belgians: +-12ms

 

 



- wheels for cosmos II


 

Link to post
Share on other sites

Incredible post Good job Sam!


Planning on trying StarCitizen (Highly recommended)? STAR-NR5P-CJFR is my referal link 

Link to post
Share on other sites

Very interesting and informative!


Cpu: I5 3570k @ 4.3ghz Gpu: EVGA GTX 780 FTW edition Case: Corsair 300R​ Ram: 8GB Corsair vengeance 1600mhz


Motherboard: ASUS P8-Z77 V-LX Keyboard: Corsair k50 raptor  Mouse: Razer naga 2012 edition OS: Windows 8.1


 

Link to post
Share on other sites

A whole post about how CPU's work and nothing about registers? What the shit?


"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."


- Albert Einstein

Link to post
Share on other sites

You did a great job my man. I have looked at other sources, and this guide really helped fill in what I didn't yet know about CPU Architecture. Thanks again for the great info my man!

 

- winny3141 :D


System Specs: AMD Phenom II X6 1100T Six-core CPU, AMD Radeon HD 6970 2 GB GDDR5 16X PCIe Video Card, MSI 890FXA-GD70 Motherboard, Kingston Hyper-X 1600 MHz RAM, ADATA 128 GB MLC SSD, 2 TB HDD, Astec Dual 120 mm closed Liquid cooling Loop, Cooler Master 800W Silent Pro Gold (80 Plus Gold Certified) PSU, Razer Black Widow Ultimate 2013 Gaming Keyboard (Love me my Cherry MX Blue Switches), a Razer Taipan Gaming Mouse (8200 dpi 4G sensor FTW!), Windows 7 Ultimate 64-bit

Link to post
Share on other sites
Posted · Original PosterOP

You did a great job my man. I have looked at other sources, and this guide really helped fill in what I didn't yet know about CPU Architecture. Thanks again for the great info my man!

 

- winny3141 :D

 

Thank you :)

Link to post
Share on other sites

Perfect explanation! 


CPU: Intel Core i7 5960X @4.5GHz cooled by Corsair H110 | MBO: ASRock Fatal1ty X99M Killer | RAM: GEIL Evo Potenza 16GB DDR4 3333MHz | GPU: Zotac GTX1080 Founders Edition | SSD: 512GB Transcend 370S | HDD: 1.5TB WD Green Drive | PSU: Corsair SF 600W | Case: Jansbo UMX3 S

Check out the build log here -> http://linustechtips.com/main/topic/257949-analogs-project-rrh-red-riding-hood/           Another build log featuring Power Mac G5 case that I never got around to uploading the latest pictures of -> http://linustechtips.com/main/topic/454140-analogs-project-silverine-ft-apple-powermac-g5-case-modding/      Latest Build Log -> UPCOMING

Link to post
Share on other sites

Impressive and usefull data there friend..

 

And some people beleive we once evolved from a slug thingy that crawed outa the sea, huh i think what the bible say's is more correct "God created man" then the woman, as intelligent beings. and that's why monkeys are still monkeys and not driving around in sports cars and playing on laptops :P

 

We are amazing people with Hubble telescope and cpu's its awesome era we are in.

 

Thanks for the info...


got to love Asus components

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×