Hardware Secrets
Home | Camera | Case | CE | Cooling | CPU | Input | Memory | Mobile | Motherboard | Networking | Power | Storage | Video | Other
Content
Articles
First Look
Gabriel's Blog
News
Reviews
Tutorials
Main Menu
About Us
Awarded Products
Compare Prices
Datasheets
Dictionary
Download
Drivers
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 (2 Vol. Set)
The Winn L. Rosch Hardware Bible, 6th Edition (2 Vol. Set), by Winn L Rosch (Que), starting at $2.31
Home » CPU
How The Memory Cache Works
Author: Gabriel Torres
Type: Tutorials Last Updated: September 12, 2007
Page: 8 of 9
$ Check REAL-TIME pricing for Intel Pentium Dual Core E5300 Processor BX80571E5300 - 2.60GHz 2MB Cache 800MHz FSB Wolfdale Retail Socket 775 $.
CircuitCity: $74.99 Newegg: $69.99
Amazon: $69.99 Directron: $74.99

n-Way Set Associative Cache

On this configuration the memory cache is divided in several blocks (sets) containing “n” lines each.

So on a 4-way set associative cache the memory cache will have 2,048 blocks containing four lines each (8,192 lines / 4), on a 2-way set associative cache the memory cache will have 4,096 blocks containing 2 lines each and on a 16-way set associative cache the memory cache will have 512 blocks containing 16 lines each. Here we are continuing our example of a 512 KB L2 memory cache divided into 8,192 64-byte lines. Depending on the CPU the number of blocks will be different, of course.

n-way set associative cache
Figure 7: 512 KB L2 memory cache configured as 4-way set associative.

Then the main RAM memory is divided in the same number of blocks available in the memory cache. Keeping the 512 KB 4-way set associative example, the main RAM would be divided into 2,048 blocks, the same number of blocks available inside the memory cache. Each memory block is linked to a set of lines inside the cache, just like in the direct mapped cache. With 1 GB RAM, the memory would be divided into 2,048 blocks with 512 KB each, see Figure 8.

n-way set associative cache
click to enlarge
Figure 8: 512 KB L2 memory cache configured as 4-way set associative.

As you see the mapping is very similar to what happens with the direct mapped cache, the difference is that for each memory block there is now more than one line available on the memory cache. Each line can hold the contents from any address inside the mapped block. On a 4-way set associative cache each set on the memory cache can hold up to four lines from the same memory block.

With this approach the problems presented by the direct mapped cache are gone (both the collision problem and the loop problem we describe on the previous page). At the same time, the set associative cache is easier to implement than the full associative cache, since its control logic is simpler. Because of that this is nowadays the most common cache configuration, even though it provides a lower performance compared to the full associative one.

Of course we still have a limited number of available slots inside each memory cache set for each memory block – four on a 4-way configuration. After these four slots are taken, the cache controller will have to free one of them to store the next instruction loaded from the same memory block.

When we increase the number of ways a set associative memory cache has – for example, from 4-way to 8-way configuration –, we have more slots available on each set, but if we keep the same amount of cache memory the size of each memory block is also increased. Continuing our example, moving from 4-way to 8-way would make our 1 GB RAM memory to be divided into 1,024 1 MB blocks. So this move would increase the number of available slots on each set, but now each set would be in charge of a bigger memory block.

There is a lot of academic discussion regarding what is the perfect balance between the number of sets and the memory block size and there is no definitive answer – Intel and AMD use different configurations, as you will see on next page.

So what happens if we have a bigger memory cache? Keeping the above example, if we increased the L2 memory cache from 512 KB to 1 MB (the only way to do that would be by replacing the CPU), what would happen is that we would have 16,384 64-byte lines in our memory cache, what would give us 4,096 sets with four lines each. Our 1 GB RAM memory would be divided into 4,096 256 KB blocks. So basically what happens is that the size of each memory block is lowered, increasing the chance of the requested data to be inside the memory cache – in other words, increasing the cache size lowers the cache miss rate.

However, increasing the memory cache isn’t something that guarantees increase in performance. Increasing the size of the memory cache assures that more data will be cached, but the question is whether the CPU is using this extra data or not. For example, suppose a single-core CPU with 4 MB L2 cache. If the CPU is using heavily 1 MB but not so heavily the other 3 MB (i.e. the most accessed instructions are taking up 1 MB and on the other 3 MB the CPU cached instructions are not being called so much), chance is that this CPU will have a similar performance of an identical CPU but with 2 MB or even 1 MB L2 cache.

Pages (9): « 1 2 3 4 5 6 7 [8] 9 »
Print Version | Send to Friend | | Bookmark Article | Comments (0)

Related Content
  • Penryn Core New Features
  • nVidia Tesla Technology
  • Inside Intel Nehalem Microarchitecture
  • Core 2 Duo, Core 2 Quad, Phenom X3 and Phenom X4: Which One is the Best USD 200 CPU?
  • Everything You Need to Know About the CPU C-States Power Saving Modes

  • Recommended Deal.
    Power Supply VX450W 450W ATXAmazon.com Corsair CMPSU-450VX 450-Watt VX Series 80 Plus Certified Power Supply compatible with Core i7 and i5 Electronics


    Amazon: $73.89 Wal-Mart: $89.98
    Newegg: $64.99 TigerDirect: $79.99

    RSSLatest News
    IN WIN LAN Party in Southern California
    November 20, 2009 - 12:37 PM PST
    Patriot Announces PS-100 SSD Series
    November 19, 2009 - 7:30 AM PST
    Antec Launches TPQ-1200 PSU
    November 18, 2009 - 11:30 AM PST
    AMD/ATI Launches Radeon HD 5970
    November 18, 2009 - 10:18 AM PST
    OCZ Launches Colossus SSD Series
    November 17, 2009 - 1:39 PM PST
    NZXT Unleashes Tempest EVO Mid-Tower Case
    November 17, 2009 - 1:06 PM PST
    nVidia Launches GeForce GT 240
    November 17, 2009 - 10:18 AM PST
    Arctic Cooling Announces Accelero TWIN TURBO PRO VGA Cooler
    November 16, 2009 - 11:46 AM PST
    PowerColor Announces PLAY! HD5770 Video Card
    November 13, 2009 - 12:51 PM PST
    G.Skill Announces Falcon II SSD Series
    November 11, 2009 - 3:31 PM PST
    .:: More News ::.

    RSSLatest Content
    Ultra X4 500 W Power Supply Review
    Seagate Barracuda XT 2 TB Hard Disk Drive Review
    Nintendo Wii Fit Plus Review
    AMD ATI Chips Comparison Table
    nVidia Chips Comparison Table
    Gigabyte G41M-ES2L Motherboard
    Netflix on Playstation 3 Review
    CM Storm Sentinel Advance Mouse Review
    Titan Skalli CPU Cooler Review
    Nexus RX-6300 630 W Power Supply Review
    Gigabyte P55-UD6 Motherboard
    Nintendo Wii Review
    SilverStone Grandia GD04 Case Review
    Can We Trust the 80 Plus Certification?
    NZXT Gamma Case Review

    Our Most Popular Articles
    Maximum CPU Temperature
    1,078,234 views
    How to Find Out Your Motherboard Manufacturer and Model
    706,064 views
    nVidia Chips Comparison Table
    679,023 views
    Connecting Two PCs Using a USB-USB Cable
    593,293 views
    How To Correctly Apply Thermal Grease
    562,380 views
    AMD ATI Chips Comparison Table
    560,029 views
    ATI Radeon X1300 Pro Review
    487,913 views
    ATI Radeon X1600 XT Review
    477,081 views
    How To Perform a BIOS Upgrade
    394,414 views
    Sempron vs. Athlon XP
    338,488 views

    Latest Threads in Our Forums
    Dell Inspiron 6000 Powers but will not boot...
    by Merman
    Ultra X4 500 W Power Supply Review
    by Merman
    IN WIN LAN Party in Southern California
    by Hardware Secrets Team
    Getting A Hard Copy
    by Trevorrross
    Am I Making The Right Choice?
    by need2know
    Is it available to mount the Zalman cooler?
    by Olle P
    dsl modem prob
    by Sherry
    Seagate Barracuda XT 2 TB Hard Disk Drive Review
    by Hardware Secrets Team
    Overclocking a dell xps 410
    by 6dracing
    How to recover mp3's, pdf & chm files, applications from formated harddrive partition
    by tomahawk 1705
    .:: Visit Our Forums ::.


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