Qeuestion on Cache….

Microsoft Windows
SQL Server
As we know that every OS is going to get frequently used info into its cache and uses to bypass the speed difference between processor and RAM... is there any way to view the contents of L1 and L2 cache in Windows or Linux...

Answer Wiki

Thanks. We'll let you know when a new response is added.

Look at the cache_level series of function calls.


Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Bobkberg
    Sorry - EnigmaticKishore sent me a private followup message asking for more detail. When you asked how to find the contents of the L1 and L2 cache, I assumed that you were a programmer, since they are essentially inaccessible without writing a program - whether it be part of a normal program, or one designed just to peek at the cache. But on top of that, the contents of the L1, L2 (and other possible cache numbers - depending on processor architecture) vary, depending on the sorts of program and operating system being run, whether the program(s) is/are multi-threaded, and how many processors are in the system (multiple L1, etc. caches). I hope that you understand that the purpose of the cache(s) is to allow the CPU to process things very quickly which would otherwise be bogged down (greatly slowed) while waiting for the instructions and/or data to be fetched from main memory. L1 cache is VERY fast, but also VERY expensive (relatively speaking). L2 cache is somewhat faster (and more expensive) than ordinary memory. By using these as buffers while other hardware does the fetching and such, the CPU is allowed to perform much faster than if it had to wait 10 or so clock cycles for a memory fetch or write to be complete. I'll even go out on a limb here - and guess that you were just wondering what those "magical" caches were doing, since the manufacturers brag about them as part of promoting the virtues of their processor architectures. Whether or not you meant to, you have asked a complex question, which I'm not really qualified to answer. As a former programmer, I know enough to understand what those things do "for a living" and what it means to me. The cache_level series of function calls are used to allow a program to deliberately read or write to the L1, L2, etc. caches in order to speed up their own performance. Since doing so requires that you know something about the architecture your particular program is running on, most applications that use these are operating systems, compilers, and the occasional application that really needs the performance boost. By way of example, most modern Windows and/or Linux programs run on hardware from the Pentium II at 200 MHz up through multi-core Intel Pentium 4's at multiple GHz clock speeds - not to mention the AMD Athlon and other series. To really take advantage of the L1 and L2 cache would require fairly specific knowledge of the processor and O/S that you plan to run on. I've probably not only done overkill on this question, but stomped it into oblivion. Disclaimer - I'm fairly certain of what I'm talking about, but I do NOT guarranty the complete accuracy. Does this better answer your question? Bob
    1,070 pointsBadges:
  • Bobkberg
    First EnigmaticKishore - Unless what you have to say to me is actually personal or confidential, please reply to the group. There are several benefits to this. 1) I may be wrong - and when it is public, someone can correct me and thereby teach me something and avoid mis-informing you. 2) I (or anyone else who replies) may have a better answer. Everyone benefits - assuming that they keep their ego in check. As for your question - What languages/OperatingSystems offer the cache_level function calls - I don't know!! My assumption is that it's probably part of the Intel/AMD instruction set, and then embedded in the Assemblers and C/C++ compilers, but I don't actually know that. Here's the point where we both hope that someone who knows more can assist you. Good luck, Bob
    1,070 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: