pagesize 及其与 4096 的比例
是否存在最小内存页(页大小)的大小不能被 2 或 1024、4096 整除的系统?
可以是3000还是3500吗?
如果 pagesize 不能被 1024 整除,任何 posix 程序都会崩溃吗?
Are there systems, where minimal page of memory (pagesize) has a size not divisible by 2, or by 1024, 4096?
Can it be 3000 or 3500?
Will any posix program break, if pagesize will be not divisible by 1024?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以放心地假设 pagesize 是 2 的幂,至少在使用三进制计算机之前是这样。实际上,现代系统的页大小是 1024 的倍数。
至于程序崩溃,很少有程序关心页大小,因此只要内核一致,一切都好。如果程序根据页面大小进行计算,并使用带有宏的标头,假设页面大小是 2 的幂(truncpage、roundpage),那么它就会出现问题。
You can safely assume that pagesize is a power of 2, at least until ternary computers are used. In practice, modern systems will have a pagesize that is a multiple of 1024.
As for programs breaking, few programs are concerned about pagesize so as long as the kernel is consistent all is well. If a program did calculations based on pagesize and used headers with macros that assume pagesize is a power of two (truncpage,roundpage) then it would have problems.