views:

112

answers:

2

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

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

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

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

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

Thanks.

A: 
  • The virtual memory for a process will be different from other process.
  • Every process will get 4GB of virtual address space ( in 32 bit windows machine) and out of which you can use 2GB of user space ( remaining is for kernel). For stack, heap, static data storage and even loading the DLLs. (This is 3GB if you use large address space)
  • Every process will get separate heap, stack independent of other process.
aJ
+1  A: 

1) Yes, each process gets its own stack.

2) Yes, each process gets its own heap.

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

ruibm