Keeping your code in L1 cache

assembly, caching, cpu, k, optimization

Solution

I think what they're saying is not that the entire program fits in L1 cache, but that all the code that runs most of the time fits in the L1 cache.

Yes, the OS allocates lots of other structures, but those are hit rarely enough to not matter.

Of course, this is all speculation -- I know nothing about the 'K' language.

Problem

I have been reading Wikipedia's article on K programming language and this is what I saw: The small size of the interpreter and compact syntax of the language makes it possible for K applications to fit entirely within the level 1 cache of the processor. I am intrigued. How is it possible to have the whole program in L1 cache? Say, CPU has 256kb L1 cache. Say my program is way less than that and it needs a very little amount of memory (say, just for the call stack and such). Say, it doesn't need any libraries (although if a program is for an OS, it would need to include kernel32.dll or whatever). And doesn't OS automatically allocates some minimal memory for any program (well, for executable code and stack and heap)? Thank you.

Original source