operating-systempagingram32-bitmemory-access

Number of RAM Accesses using Paging on a 32bit processor


Paging Architecture

Assuming we use a 32bit Processor with Paging as its memory management scheme. My question is what is the range of possible accesses it might need in order to find the physical adress.

My answer is 0 to 3.

First, it will look for the virtual address in the TLB if it is there then we have 0 accesses.

If it is not there then with the first 10 bits it will do 1 access in the page directory. After it will check the L1 cache with this PDE, if it finds it then we have 1 access in total.

Otherwise, it will move to the page table (according to the PDE) and it will do another memory access based on the second 10 bits of the virtual address. Then it will check the L2 cache with this PTE, if it finds then we 2 RAM accesses in total.

At, last it will use the last 12 bits (the offset) in order to access the RAM in the wanted physical address, giving us 3 accesses in total.

Is the above rationale correct? I am not familiar on how we use L1 and L2 cache.

Thanks


Solution

  • Is the above rationale correct?

    It's mostly correct, there's just one subtlety you've overlooked...

    My question is what is the range of possible accesses it might need in order to find the physical address.

    Otherwise, it will move to the page table (according to the PDE) and it will do another memory access based on the second 10 bits of the virtual address.

    At this point it has the physical address; so the answer is "0 to 2 accesses".

    What happens after it already has the physical address (if the data at that address is cached or becomes a 3rd access) doesn't change the answer.