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




Recommended Book
The Winn L. Rosch Hardware Bible (6th Edition)
By Winn L Rosch
Que
Price: $0.94

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 Core 2 Duo Retail Boxed E7200 Processor - 2.53GHz, 3MB Cache, 1066MHz FSB, 45nm Wolfdale E700 Boxed Processor $
CompuVest: $129.91 PCNation: $138.32
Dell: $159.99 Newegg.com: $119.99
ZipZoomfly.com: $119.00 TigerDirect: $139.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
  • VIA C7-M Processor
  • Inside Pentium 4 Architecture
  • All Pentium 4 Models
  • How Chips are Manufactured
  • Intel Fab18 Factory Tour in Kiryat Gat, Israel

  • Recommended Deals
    AMD Athlon 64 3500+, 2.2 GHz (ada3500dik4b) OEM / Unboxed Processor


    ZipZoomfly.com: $59.99 CompuVest: $42.99
    Zappos: $826.00 Hpshopping: $441.99
    AMD Athlon™ XP 2800+, 2.8 GHz (AXDA2800BOX) Retail Processor


    ZipZoomfly.com: $106.99 Circuitcity: $549.99
    Compusa: $599.99 Riverton Studios: $793.00
    Bestbuy: $579.99 Amazon: $998.57
    AMD Athlon™ 64 3800 3800+, 2 GHz AMD Processor in a Box (PIB)


    Server Supply: $135.00 Amazon: $103.39
    Zappos: $826.00 Hpshopping: $441.99
    AMD Athlon™ 64 3000+, 2.0 GHz (ada3000box) AMD Processor in a Box (PIB)


    ZipZoomfly.com: $105.00 Hpshopping: $441.99
    Zappos: $826.00
    Intel Core™2 Quad Q6600, 2.40 GHz (BX80562Q6600) Boxed Processor


    CompUSA.com: $189.99 Dell: $329.99
    Circuit City: $279.99 ZipZoomfly.com: $188.50
    TigerDirect.com: $189.99

    RSSLatest News
    Patriot Launches SO-DIMM DDR3-2000
    September 5, 2008 - 7:28 AM PST
    Kingston Unveils HyperX SO-DIMM Memory Kit
    September 4, 2008 - 10:59 AM PST
    Thermaltake Launches V9 Case Series
    September 3, 2008 - 7:54 AM PST
    Sigma Launches 1,000 W Power Supply
    September 2, 2008 - 7:55 AM PST
    Intel Launches New Processors
    September 1, 2008 - 11:16 AM PST
    Scythe Launches Kaze Maru Case Fan
    September 1, 2008 - 10:24 AM PST
    Lian Li Launches Silent Force Power Supply Series
    August 29, 2008 - 9:24 AM PST
    New Thermaltake Power Supplies
    August 28, 2008 - 11:43 AM PST
    Sparkle and MSI Launch GeForce 9400 GT
    August 28, 2008 - 11:13 AM PST
    NZXT Unveils Whisper Full Tower Case
    August 28, 2008 - 10:39 AM PST
    .:: More News ::.

    RSSLatest Content
    Everything You Need to Know About the CPU C-States Power Saving Modes
    AMD ATI Chips Comparison Table
    nVidia Chips Comparison Table
    Inside Intel Nehalem Microarchitecture
    OCZ Elixir Gaming Keyboard Review
    Everything You Need to Know About The QuickPath Interconnect (QPI)
    Me and Woz
    Introduction to Wireless USB (WUSB)
    Nikon Coolpix S600 Camera Review
    IDF Fall 2008: Opening Keynote
    Thecus N5200 NAS Review
    ECS GeForce 9800 GTX+ Hydra Video Card Review
    320 GB Hard Disk Drive Round-Up
    Razer Destructor Mouse Pad Review
    Sapphire HD 4870 X2 Video Card Review

    Our Most Popular Articles
    Maximum CPU Temperature
    772,515 views
    nVidia Chips Comparison Table
    480,536 views
    AMD ATI Chips Comparison Table
    425,785 views
    ATI Radeon X1300 Pro Review
    413,942 views
    ATI Radeon X1600 XT Review
    408,696 views
    How to Find Out Your Motherboard Manufacturer and Model
    385,423 views
    Connecting Two PCs Using a USB-USB Cable
    347,988 views
    How To Correctly Apply Thermal Grease
    333,244 views
    Sempron vs. Athlon XP
    280,170 views
    Sempron 3400+ Review
    270,375 views

    Latest Threads in Our Forums
    Flip Ultra Camcorder
    by Hardware Secrets Team
    2.1 PC speakers in car
    by rajani1983
    How to conect spdif on my nvidia 9600 gt with x-fi extreme gamer spdif
    by yapyap
    Review - Logitech X530 (5.1)
    by tomahawk 1705
    Slipstreaming SP3
    by BedCommando
    powercolor x1650 pro agp problem
    by jedsky
    Building PC for Audio.
    by Wall'E
    What configuration is better??
    by Gabriel Torres
    Upgrading to dual core
    by Gabriel Torres
    Patriot Launches SO-DIMM DDR3-2000
    by Hardware Secrets Team
    .:: Visit Our Forums ::.

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