In: Computer Science
Provide an in-depth and detailed explanation describing how the virtual page size of a memory system might affect the performance of cache when the virtual page size is very large and then when it is very small.
Virtual Memory is the physical memory is divided into fixed size pages. Loadable modules are also divided into number of page frames. Page frames are always the same size as the pages in memory. Page frames are loaded into memory only when they are needed. It is a fixed-length contiguous block of virtual memory described by a single entry in the page table. It is the smallest unit of data for memory management in a virtual memory operating system.
Normally a virtual address is 32 bits, this allows a process to have 4GB of virtual memory.
Physical memory is much smaller than this memory and it varies from one machine to another.
And also, virtual address space for different process is distinct.
A virtual memory having the following structure:
1. Paging
2. Segmentation
A paging handles a virtual memory into small units called page frames. So the virtual memory is divided into small units called pages. The size of a page is equal to the page frames.
A page size can be determined by using some of the factors. That are:
1. A Operating System is the authority to determine the page size.
2. If it is a smaller page size, then:
a) It has less internal fragmentation (unused space within the page)
b) And also, it can match with the locality of refence.
3. If it is a larger page size then:
a) It contains a less number of pages and also smaller page table.
b) It also has less page fault.
c) It may be responsible for less over head in reading/writing of pages.
Cache memory is a very high-speed memory that act as a buffer between RAM and the CPU. It holds the frequently requested data and instructions so they can immediately available to the CPU when needed.
It reduces the average time to access the data from the Main Memory. When the processor needs to read/write a location in main memory, it first checks in the cache memory. If the data is available in the cache then it is cache hit. But in case of the data is not available in the cache then it is cache miss.