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("%p\n", 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

• 4K is $2^{12}$. Each hex digit represents four binary ones. Apr 7 '21 at 3:19
• @greybeard how do I find out which hex digits correspond with the page number and the offset? Like is the offset the last 24 bits or...? Apr 7 '21 at 4:41
• This question most probably came up in some environment introducing into implementation of computers (using electronic circuitry for now). It would seem time to revisit whatever material there is on paged memory. While the offset is in the less significant part, even with bit addressable memory it would not take 24 bits to identify one cell in a 4KB page. Apr 7 '21 at 7:47