Information Technology Reference
In-Depth Information
Virtual Addresses
(Process Layout)
DATA
STACK
CODE
HEAP
DATA
STACK
CODE
HEAP
Physical Memory
Figure2.6: Virtual addresses allow the stack and heap regions of a process
to grow independently.
intstaticVar=0;
/*astaticvariable*/
main(){
intlocalVar=0; /*aprocedurelocalvariable*/
staticVar+=1;
localVar+=1;
sleep(10); /*thiscausestheprogramtowaitfor10seconds*/
printf(``staticaddress:%x,value:%d\n'',&staticVar,staticVar);
printf(``procedurelocaladdress:%x,value:%d\n'',&localVar,localVar);
}
>staticaddress:5328,value:1
>procedurelocaladdress:ffffffe2,value:1
 
Search WWH ::




Custom Search