操作系统的页是虚拟存储的关键技术.

[code lang="cpp"]
#include <unistd.h>
#include <stdio.h>
int main()
{
int pageSize = getpagesize();
printf("Page size on your system = %i bytes\n", pageSize);
return 0;
}
[/code]

在我电脑里的运行结果:
[code light="true"]
$./a.out
Page size on your system = 4096 bytes
[/code]

相关文章:

  One Response to “如何得到当前linux系统的页大小”

  1. [...] 每个页能存储的数据多少,不同的系统会有不同。可以写个小程序判断页大小(如何得到当前linux系统的页大小)。页容量大,页缺失就少,减少不必要的内核动作。但这也有坏处,因为系统只能在一个页内通过分段来访问主存。若页太大,内存可用的页少,则势必浪费存储空间。通常的页大小为4KB-8KB.你可以通过修改内核头文件asm/param.h的EXEC_PAGESIZE,设置页大小。 [...]

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
2009-2011© 编译点滴 Suffusion theme by Sayontan Sinha

无觅相关文章插件,快速提升流量