ok, ...
as I understand the cache memory is what should CPU do and what the instructions that should be done , I mean the CPU bring this info to execute(hit or miss) the processes from the cache memory, but after executing the files may remain useless files and we can clean them |
Not sure how you've gone from CPU instructions and cache memory, to files.
There are some fundamental misunderstandings here, not sure where to begin.
A computer does it's
computations in the CPU. The CPU is connected to memory via a memory bus. It doesn't know what a file is, what a network connection is, ... any of that stuff. It only operates on instructions that are stored in memory and on data that's stored in memory or CPU registers. To the hardware, instructions and data the same thing. Give some memory as an instruction, it'll be executed, treat an instruction as data, it'll treat it as such.
Over the years, the CPU speed has grown much faster than memory. But that means the CPU is mostly waiting for data transfers to/from memory. What to do?
One solution is to build memory into the CPU that's quicker to access. Of course, there isn't much of it, so it's just used to keep copies of sections of the real memory behind it. That's a cache. And that idea can be used again with even different faster/smaller memory, hence multilevel caches.
Note, none of this has anything to do with files. A file is a concept used by the operating system, the computer hardware doesn't know about files. Cleaning, clearing, moving, deleting, creating files has no direct consequence for the hardware, besides the time it takes to process them.