0

Is there any tool that can tell me which cache set the data is placed in when I run the C language? What data is placed in each Cache line?

The reason for doing this is because I want to have a deeper understanding of the cache replacement strategy. So I want to know what data has been fetched into the cache. And when reading the data, which cacheLine was replaced. In some cases, I want the data of a CacheSet to follow my design. So I want to be able to know the details of the data in the cache.

8
  • 4
    What cache are you in particular talking about? Commented Nov 11, 2020 at 7:09
  • 2
    It is the first time I hear that user could actually get some information about CPU cache. That is completely in the domain of CPU and its HW. No program should have access to it. And since it is HW, I do not understand your comment using CPU cache and linux together. CPU cache is completely unrelated to operating system. Maybe you meant some API in linux that would give you that information? Commented Nov 11, 2020 at 7:34
  • 1
    @cyj answer question queries by improving the question. So that new readers don't have to read all comments to understand the question. Commented Nov 11, 2020 at 10:41
  • 1
    i was under the impression that cache is a blackbox, and that's why programs have to be written in a specific way to get the most effective use of it Commented Nov 11, 2020 at 12:16
  • 2
    If you just want to understand the working of the CPU cache, you might want to use a CPU emulator, so you can slow it down/pause it and inspect the emulator's internal state. If you want to see it from an actual CPU, you would need high-speed logic analyzers and/or possibly CPU manufacturer's debugging tools (actual hardware tools!), which may only be available to CPU manufacturer's employees only. Commented Nov 11, 2020 at 12:24

1 Answer 1

1

Of course you cannot know what data is in the cache. First of all, on the server, the data in the cache is not only your personal, but also at the hardware level. Generally, only insiders can fully know all its parameters. You can know the data in the cache on the simulator.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.