Hi there!
In about 10 days or so I should have a systems interview and I was directed to this site for studying by the interviewer:
https://www.tldp.org/LDP/tlk/tlk.html
In the memory management segment I have a few things I haven't managed to understand:
1. Where does exactly the virtual addresses for every process are sitting at? The kernel part of the physical memory?
2. Is the swap partition a separate section on the HDD where linux should keep stuff that are in physical memory but had to kick out since they were selected to be kicked out AND they are edited somehow = therefor the system has to keep them somewhere before being ultimately saved on the HDD?
3. What exactly is a multi-level page table? Is the meaning of it that you can have fewer, more relevant page tables for each process and keep the other ones NOT on physical memory and therefor ease the weight?
Like instead of 1M entries, go with a 1K entries page table where every entry leads to another page table with 1K entries etc.
4. The free_area vector is like an array where the i'th cell is the collection of every 2^i sized blocks that are free?
5. Is the general idea of demand paging is to get the most relevant part (well, page) to physical memory, and once the process calls for another one using another virtual address it won't be there on the physical memory and therefor creates a page fault and then linux brings the next page and the process tries to call that virtual address again?
6. The mm_struct contains info about an image that is being executed. It also contains pointers to vm_area_struct - what are they exactly? It says that they describe the start and end of an area of virtual memory, but they way I got it the virtual memory of every process is actually pretty much the same, it is the mapping of it that makes it different and allow each process to do it's things.
Is the goal of it to separate the virtual addresses in the virtual space of each process in order to supply them with different instructions or set operations?
7. Caches - what are they exactly for gods sake? It says that there are the Buffer, Page, Swap and Hardware cache (Which is basically the TLB?).
What is the actual mechanism that describes how linux uses them?
As pages gets loaded into the page cache, then linux can remove those pages from the physical memory? Or it is just a way to save the translation from the page table?
What it means for a page to be present in a cache?
How does linux treat the page accordingly?
8. In the last part of this page (3.7 and on) it is explained that in order to free memory linux will try to:
(a) Reducing the size of the buffer and page caches
(b) Swapping out System V shared memory pages
(c) Swapping out and discarding pages
(c) I get, but can you please elaborate on the other two?
Why reducing size of buffer\page cache and swapping out System V shared pages (What are they anyway?) can help to free memory?
I guess this is quite the quiz, but I hope someone can contribute his knowledge and help me to prepare as best I can.
Thanks!