PC RAM和进程地址空间 [英] PC RAM and process address space

查看:117
本文介绍了PC RAM和进程地址空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的PC中有3 gb的ram和250 gb的硬盘.
现在,我编写了一个简单的C程序,它只有一个语句malloc()来分配4 gb的内存,因为32位操作系统可以寻址4gb的地址空间,那么malloc会成功吗?
如果是,那么它将如何获得额外的1 GB内存?
进程仅从RAM还是从硬盘获取内存?

Suppose I have 3 gb of ram and 250 gb hard disk in my pc.
Now I wrote a simple C program having only one statement malloc() to allocate 4 gb of memory as 32 bit os can address 4gb address space then will the malloc succeed?
If yes then how it will get extra 1 gb of memory?
Does the process gets memory only from RAM or also from harddisk?

推荐答案



当请求的内存大于RAM大小时,操作系统将使用虚拟内存技术.
看一下这篇文章:
Virtual_memory [ ^ ]


最好的问候.
Hi,

When the requested memory is higher than RAM size, The OS uses virtual memory technique.
take a look at this artical:
Virtual_memory[^]


Best regards.
EL GAABEB.


通常堆大小小于4 Gb,例如,参见 [虚拟内存的工作原理" [ ^ ].
Usually heap size is lower than 4 Gb, see, for instance "Why can''t I get a larger heap with the 32-bit JVM?"[^].
The process gets virtual memory that is partly mapped on the hard-disk, see "How Virtual Memory Works"[^].


这篇关于PC RAM和进程地址空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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