使用虚拟内存,系统上运行的程序所分配的内存可能远远超过物理上可用的内存. [英] With virtual memory, programs running on the system can allocate far more memory than is physically available;

查看:310
本文介绍了使用虚拟内存,系统上运行的程序所分配的内存可能远远超过物理上可用的内存.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

操作系统如何做到这一点

使用虚拟内存,系统上运行的程序可以分配远 内存大于实际可用内存;

解决方案

在实践中,它是多一点的内存",而不是更多的内存",否则您将尝试 MMU . 虚拟内存系统使用它来提供虚拟的分页& 页面缓存.当内核出现页面错误时,它可以从磁盘-例如g中获取页面.在 ELF 可执行文件或共享对象或某些其他映射文件,或某些交换区域-或发送SIGSEGV信号,请参见 signal(7 ).

在Linux上,几个系统调用可以更改地址空间: execve(2).您可以使用 madvise(2) 来建议内核>

您可以使用cat /proc/$somepid/maps(例如,外壳程序中的cat /proc/$$/maps)来了解某些过程.参见 proc(5).

点击上面的所有链接,并阅读高级Linux编程 解决方案

It is in practice "a little more memory", not "far more memory", otherwise you are experimenting thrashing.

Every desktop, latop or server processor has an MMU. It is used by the virtual memory system to give a virtual address space thru paging & the page cache. When the kernel gets a page fault, it could fetch a page from disk -e.g. in a segment of an ELF executable or shared object or some other mapped file, or some pages from the swap area- or send a SIGSEGV signal, see signal(7).

On Linux, several system calls can change the address space: mmap(2) and munmap (and also the obsolete sbrk, etc...) and execve(2). You might advise the kernel using madvise(2)

You could use cat /proc/$somepid/maps (e.g. cat /proc/$$/maps in your shell) to understand the address space map of some process. See proc(5).

Follow all the links above and read also Advanced Linux Programming and Operating Systems: Three Easy Pieces

这篇关于使用虚拟内存,系统上运行的程序所分配的内存可能远远超过物理上可用的内存.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆