I am looking to calculate the physical address corresponding to a logical address in a paging memory management scheme. I just want to make sure I am getting the calculation right, as I fear I could be wrong somewhere.
So, the data I have is as follows:
The logical address: $717$
Logical memory size: $1024$ bytes ($4$ pages)
Page Table:
\begin{array}{| c | c |} \hline Page\ Number & Frame\ Number\\ \hline 0 & 5\\ \hline 1 & 2\\ \hline 2 & 7\\ \hline 3 & 0\\ \hline \end{array}
- Physical memory: $16$ frames
So, with $1024$ bytes in the logical memory, and $4$ pages, then each page is $256$ bytes.
Therefore, the size of the physical memory must be $4096$, right? ($256 \times 16$).
Then, to calculate the logical address offset:
$$1024 \mod 717 = 307$$
Is that how we calculate the offset?
And, we can assume that $717$ is in page $2$ ($\frac{1024}{717} = 2.8$)?
So, according to the page table, the corresponding frame number is $3$.
And so to get the physical address, we multiply the frame number and page size?
$$2 \times 256 = 768$$
Then, do we add the offset, like so:
$$768 + 307 = 1,075$$
Thank you for taking the time to read. If I don't quite have this correct, would you be able to advise on the correct protocol to calculating this?