To that end;
1) Buy/Beg/Borrow/Steal the Curt Schimmel book mentioned above. That one book will teach you all about how OSes manage caches/memory for SMP multiprocessing systems. You really get to understand multiprocessing at a fundamental level.
2) Memory Systems: Cache, DRAM, Disk by Bruce Jacob et al. - Old classic and a comprehensive book on all aspects of memory systems. Supplement with papers on newer technologies as needed.
3) Ulrich Drepper's classic What every Programmer should know about Memory - https://news.ycombinator.com/item?id=36420502
4) Cache-Oblivious Algorithm - https://en.wikipedia.org/wiki/Cache-oblivious_algorithm See in particular, Harald Prokop's thesis on the above linked to under "References" section.
5) Cache-aware Programming pattern from the book Game Programming Patterns - https://gameprogrammingpatterns.com/data-locality.html
6) There are lots more resources on cache-aware programming and using compiler builtins to help you do it. Here is a list of tips - https://johnnysswlab.com/make-your-programs-run-faster-by-be... This website has a lot of info. on all aspects of memory optimization.
7) AoS and SoA - https://en.wikipedia.org/wiki/AoS_and_SoA