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

StackOverflow https://stackoverflow.com/questions/16976544

  •  31-05-2022
  •  | 
  •  

Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top