0
$\begingroup$

A $64$-bit computer has a virtual mem space of $2^{64}$ bytes and the computer also uses memory paging with size of $2^7$ $(128)$ bytes.

Work out the bits of the memory address which are used for the page number?

No. of bits of the memory address which are used for the offset?

Can someone explain how I would go about doing this ?

$\endgroup$

1 Answer 1

1
$\begingroup$

Your virtual address is of size $64$ bits. This means your system can address $2^{64}$ bytes. Each virtual address your system generates points to a byte of memory.

Your system has a page size of $2^7$ bytes. Operating systems like to group bunches of memory bytes together into what is called a page. Think about each page as a block of memory that contains many bytes.

We have a virtual space of $2^{64}$ bytes that we need to page. How many blocks of memory (of size $2^7$ bytes) can we fit in this address space (of size $2^{64}$ bytes) ? $2^{64}$ / $2^7$ = $2^{57}$ blocks (or pages).

We need $2^{57}$ pages. Therefore, there would be $57$ bits required to address each page that we have.

Now, remember each page has $2^7$ bytes. If your OS were looking for a specific byte, the first $57$ bits in the address would have the page number it wants. Then, the last $7$ bits would address a byte on that page. The number of bits used to address a byte in a page is called the offset.

So, $7$ bits for the offset, $57$ bits for the page number. Together, they equal a $64$ bit virtual address.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.