Find offset and page number given paged virtual memory address I ran into this question in class:
Assume a machine that is 64-bit and has 8GB memory. They use a paged virtual memory where the page size is 4KB. You run the following program:
int main() {
   int *ptr = malloc(16);
   printf(&quot;%p\n&quot;, ptr);
   return 0;
}

and get output:
0x555555756260
We're to find the virtual page number of the address and the offset.
What I'm thinking is that I first convert that to binary, figure out how many bits and which bits represent the address/offset.
But I'm not sure how to figure out the latter. How can I determine which bits in the address correspond to which?
I'd really love some guidance
assume address printed out to be a &quot;byte address&quot;
guess whether the offset to find is addressable unit in page or byte in page

if addressable unit in page, figure out its size
with nothing more than 64-bit to go on a first assumption is 8 bytes


guess the representation wanted for virtual page number &amp; offset

(Base conversions in the process depend on practice with the representations involved. For a result in hex, too, some would prefer to just double (word offset) or halve (&quot;byte page#&quot;) &quot;in hex&quot;. A coder might have a program print both parts before even considering if coding the task was least effort.)