Memory Flashcards
How does one find the actual amount of used memory when using the top utility?
Actual Memory Used = Used - Cached
In terms of memory, what is a common occurrence on a system that has been running awhile.
A large portion of the RAM will be taken up by the cache.
Why does memory pressure occur?
Memory pressure occurs when memory is needed on a system. Processes may be killed, memory may be swapped out, data may be removed from the cache, etc.
How do you tell you are under memory pressure?
Look for the entries in /proc/vmstat. Virtually all the entries that say “scan” in them are reacting to memory pressure. These counters also have per-zone counterparts in /proc/zoneinfo.
What are the different layers of memory? What is the order from fastest to slowest?
CPU register, CPU cache, RAM, disk.
How large is a page?
4KB
What is paging?
Paging is the movement of pages in and out of memory. Allows partially loaded programs to execute, making it possible for programs larger than the main memory to run.
Difference between a dirty page and a clean page.
A dirty page requires a write to the disk before unloading the file from memory.
Ex: Opening a file, adding a word and then saving the file
A clean page means no changes were made to a file, so it can be unloaded from memory immediately.
What is file system paging?
Reading/writing of pages in memory mapped files and of filesystems that use the page cache.
What is anonymous paging?
Paging that is private to a process. Anonymous paging = swapping (moving pages in and out of swap). Page ins can hurt performance as they are run synchronously.
On demand paging
On demand paging maps pages of virtual memory to main memory when it is needed as opposed to when memory is first allocated.
What is a page fault and when does it occur?
A page fault occurs the first time a page of virutal memory is mapped. The page takes longer to access the first time than it will thereafter.
What makes up the Virtual memory size?
Resident Set Size(RES)?
Virt Size = Size of all allocated pages(unmapped, mapped to main memory, mapped to swap)
RES = size of allocated main memory pages
What do the file system cache and buffer cache improve?
The file system cache improves read performance, while buffering inside the cache improves write performance.