Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why the page size of OS is 4k, and why it still stick to be 4k as the memory can be large enough now?

Tags:

page-size

As far as i know, the page size is 4k in OS memory management. It can be a advantage when the memory is too small. But the memory in our machine is big enough now, why the page size is still 4k? What is the limit for change it to be like 1M or bigger?

like image 231
Perth Charles Avatar asked Jun 07 '13 05:06

Perth Charles


1 Answers

4KB is just default page size supported by many architectures.

However, some architectures support switching to use bigger page sizes. For example, i386 supports switching to huge pages mode with 2MB or 4MB page size, and x86_64 supports 2MB huge pages, and for some newer CPUs it can even support 1GB page size (large pages).

Many filesystems use block size that is exact page size or small multiplier of it (4KB-8KB or so). Also, many operating systems allocate memory only in whole pages. Allocating 2MB page on every memory allocation request would waste a lot of memory.

like image 69
mvp Avatar answered Oct 17 '22 03:10

mvp