| How a CPU Works |
|
|
Real-time pricing for AMD ADX245OCGQBOX |
| AMD Athlon II X2 245 Dual Core Processor - 2.90GHz Socket AM3 2MB Cache 2000MHz 4000 MT/s Retail ADX245OCGQBOX |
|
|
|
|
|
| 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 on 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.
|
| Pages (9): « 1 2 3 4 5 [6] 7 8 9 » |
| Print Version | Send to Friend |
|
Bookmark Article
| Comments (8)
|
|
Recommended Deal |
 | Thermaltake CL-P0466
Thermaltake SpinQ CPU Cooler - Socket 775 939 754 AM2/AM2 /1366/1156 Support CL-P0466
|
|
Latest News |
March 19, 2010 - 10:17 AM PST |
March 19, 2010 - 9:59 AM PST |
March 19, 2010 - 9:39 AM PST |
March 17, 2010 - 3:40 PM PST |
March 16, 2010 - 3:46 PM PST |
March 15, 2010 - 1:43 PM PST |
March 12, 2010 - 12:19 PM PST |
March 10, 2010 - 4:08 PM PST |
March 9, 2010 - 4:15 PM PST |
March 8, 2010 - 2:59 PM PST |
| .:: More News ::. |
|
Latest Content |
|
|
| Our Most Popular Articles |
1,155,746 views
|
818,675 views
|
743,652 views
|
673,118 views
|
625,956 views
|
610,367 views
|
506,827 views
|
494,498 views
|
443,875 views
|
381,954 views
|
|
| Latest Threads in Our Forums |
by thebigman101 |
by Hardware Secrets Team |
by Hardware Secrets Team |
by Hardware Secrets Team |
by Hardware Secrets Team |
by Olle P |
by Hardware Secrets Team |
by Hardware Secrets Team |
by Hardware Secrets Team |
by Mescalamba |
| .:: Visit Our Forums ::. |
|
|