Hardware Secrets


Home | Camera | Case | CE | Cooling | CPU | Input | Memory | Mobile | Motherboard | Networking | Power | Storage | Video | Other
Content
Articles
Editorial
First Look
Gabriel’s Blog
News
Reviews
Tutorials
Main Menu
About Us
Awarded Products
Compare Prices
Datasheets
Dictionary
Download
Drivers
Facebook
Forums
Links
Manufacturer Finder
Newsletter
On The Web
RSS Feed
Test Your Skills
Twitter
Newsletter
Subscribe today!
Search




Recommended
The Winn L. Rosch Hardware Bible, 6th Edition
The Winn L. Rosch Hardware Bible, 6th Edition, by Winn L Rosch (Que), starting at $0.48
Home » CPU
How a CPU Works
Author: Gabriel Torres
Type: Tutorials Last Updated: September 26, 2005
Page: 6 of 9
Real-time pricing for Zalman CNPS10XEXTREME.
Copper/aluminum Cpu Cooler Zalman CNPS10XEXTREME 35554 Electronics Usually ships in 24 hours
Amazon: $62.78 Newegg: $65.99
TigerDirect: $74.99 CompUSA: $74.99

Branching

As we mentioned several times, one of the main problems for the CPU is having too many cache misses, because the fetch unit must access directly the slow RAM memory, thus slowing down the system.

Usually the use of the memory cache avoids this a lot, but there is one typical situation where the cache controller will miss: branches. If in the middle of the program there is an instruction called JMP (”jump“ or ”go to“) sending the program to a completely different memory position, this new position won’t be loaded in the L2 memory cache, making the fetch unit to go get that position directly in the RAM memory. In order to solve this issue, the cache controller of modern CPUs analyze the memory block it loaded and whenever it finds a JMP instruction in there it will load the memory block for that position in the L2 memory cache before the CPU reaches that JMP instruction.

Unconditional Branching
click to enlarge
Figure 8: Unconditional branching situation.

This is pretty easy to implement, the problem is when the program has a conditional branching, i.e., the address the program should go to depends on a condition not yet known. For example, if a =< b go to address 1, or if a > b go to address 2. We illustrate this example in Figure 9. This would make a cache miss, because the values of a and b are unknown and the cache controller would be looking only for JMP-like instructions. The solution: the cache controller loads both conditions into the memory cache. Later, when the CPU processes the branching instruction, it will simply discard the one that wasn’t chosen. It is better to load the memory cache with unnecessary data than directly accessing the RAM memory.

Conditional Branching
click to enlarge
Figure 9: Conditional branching situation.

« Previous |  Page 6 of 9  | Next »
Print Version | Send to Friend | Bookmark Article | Comments (20)

Related Content
  • Sempron vs. Athlon XP
  • Maximum CPU Temperature
  • How to Upgrade Your CPU
  • Core i7-980X CPU Review
  • Phenom II X6 1090T CPU Review

  • Recommended Deal.
    Zalman CNPS10XEXTREMEZalman CNPS10XEXTREME

    Copper/aluminum Cpu Cooler Zalman CNPS10XEXTREME 35554 Electronics Usually ships in 24 hours

    Amazon: $62.78 Newegg: $65.99
    TigerDirect: $74.99 CompUSA: $74.99

    RSSLatest News
    Antec Announces the One PC Case
    February 9, 2012 - 8:06 AM PST
    Cooler Master Releases Elite 361 PC Case
    February 8, 2012 - 7:50 AM PST
    Microsoft Launches Kinect for Windows
    February 2, 2012 - 8:42 AM PST
    Transcend Announces SSD720 SSD Series
    February 1, 2012 - 7:55 AM PST
    .:: More News ::.


    © 2004-12, Hardware Secrets, LLC. All rights reserved.
    Advertising | Legal Information | Privacy Policy
    All times are Pacific Standard Time (PST, GMT -08:00)