So, I've been starting to think about projects outside of meshing. It's not like I'll ever be done meshing but I wanna try something radically different. And no, I'm not expecting it to be easy or that I'll even actually finish. But I wanna learn about it and I wanna know what I'd need to learn to actually learn it.
And meshing made me learn about computers and hardware and memory and I know I still have a long way to go but do you think it would be possible to learn just this one little subset of kernel design?
I've heard cache management is implementation designed and it seems low level enough that I'd be able to use C for something that truly relies on C. I mean, if Unix was written in C then I mean, C can write kernel-level code, right?
So, what do I know about cache management?
It's basically RAM that operates at your CPU's frequency and doesn't need to be bused around the motherboard.
It's got a finite size and it needs to behave just like memory in the sense that we can both read and write.
It needs to intelligently prefetch data (does it prefetch instructions as well? Can I store an instruction set in the cache?) and needs to purge data that quickly becomes unused.
I feel a naive way of doing this is to store the most relatively used data and have thresholds for when something is now a higher priority to keep in the cache than something that is suddenly lower in the pool.
I feel it would be ideal to keep the cache as clean as possible.
As for writing, it'd be simple to just let programs write their output to the cache and the write it back to the system RAM in pages once it's consuming either the rest of the cache pool or a significant fraction thereof.