| How a CPU Works |
|
|
Real-time pricing for Zalman CNPS10XEXTREME |
| Copper/aluminum Cpu Cooler Zalman CNPS10XEXTREME 35554 Electronics Usually ships in 24 hours |
|
|
|
|
|
| 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.
 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.
 click to enlarge Figure 9: Conditional branching situation.
|
| « Previous | Page 6 of 9 | Next » |
| Print Version | Send to Friend |
Bookmark Article
| Comments (20)
|
|
|
|
Recommended Deal |
 | Zalman CNPS10XEXTREME
Copper/aluminum Cpu Cooler Zalman CNPS10XEXTREME 35554 Electronics Usually ships in 24 hours
|
|
 Latest News
February 10, 2012 - 8:20 AM PST
February 9, 2012 - 8:06 AM PST
February 8, 2012 - 7:50 AM PST
February 7, 2012 - 8:31 AM PST
February 6, 2012 - 7:40 AM PST
February 3, 2012 - 8:19 AM PST
February 2, 2012 - 8:42 AM PST
February 2, 2012 - 8:41 AM PST
February 1, 2012 - 4:50 PM PST
February 1, 2012 - 7:55 AM PST
 Latest Content
Our Most Popular Articles
1,612,375 views
1,413,243 views
1,157,355 views
1,116,701 views
1,043,107 views
943,386 views
741,222 views
669,005 views
652,216 views
622,565 views
Latest Threads in Our Forums
by Athlonite
by RayBay
by RayBay
by WreakingHavoc
by dlb
by loonicy
by Hardware Secrets Team
by Gabriel Torres
by Hardware Secrets Team
by Gabriel Torres
|