Discussion about this post

User's avatar
angel c's avatar

Great post, I was just computing how much space is needed to allocate 100MB on 64 bit. In the post it is said to be 1-2 MB. However, to me it seems a bit lower.

To simplify let's consider the space required to allocate 128MB: (2^7)*(2^20) Bytes.

With pages of size 4096 Bytes (2^12 Bytes), we need to allocate: (2^7)*(2^20)/(2^12) Pages.

That is 2^15 Pages.

Since, each L1 table can refer to 2^9 Pages, we need at least (2^15)/(2^9)=2^6 full L1 Tables.

This occupies (2^6)*(2^9)*8 Bytes = 2^18 Bytes

Then we need to add 2^6 L2 entries to refer to the L1 tables.

This occupies 2^6*8 Bytes = 2^9 Bytes

Overall we need 2^18+2^9 Bytes, that is 256KB+512Bytes.

Are my computations correct or am I missing something?.

Thank you very much.

Expand full comment

No posts