堆/堆栈和多个进程 [英] Heap / Stack and multiple processes

查看:104
本文介绍了堆/堆栈和多个进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有两个进程p1,p2作为我的应用程序的一部分运行.

Say I have two process p1,p2 runnning as a part of my application.

假设p1开始运行时先执行函数f1(),然后f1()调用f2().通过调用f2(),过程p2开始执行

Say p1 is running initially executing function f1() and then f1() calls f2().With the invocation of f2() process p2 starts excuting

我要确认的是:- 1)我们有用于不同过程的单独堆栈吗?

What I want to confirm is it that :- 1)Do we have seperate stack for different process?

2)我们是否有用于不同进程的单独堆?还是不同的进程共享同一堆?

2)Do we have seperate heap for different process? or do different process share same heap?

3)我们知道,对于32位操作系统,每个进程的虚拟内存大小为4GB.因此,对于每个具有4GB虚拟内存的进程,这4GB也会被分区进入堆,堆栈,文本,数据

3)As we know that for a 32 bit OS do for every process the size of virtual memory is 4GB .So is it that for every process which has 4GB as virtual memory this 4GB is partitioned into heap,stack,text,data

谢谢.

推荐答案

1)是,每个进程都有自己的堆栈.

1) Yes, each process gets its own stack.

2)是的,每个进程都有自己的堆.

2) Yes, each process gets its own heap.

3)我认为您不会获得整个4GB的存储空间.其中一些是保留给内核的东西.

3) I don't think you get the whole 4GB. Some of it is reserved for kernel stuff.

这篇关于堆/堆栈和多个进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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