operating system - how are global variables stored differently in memory than local variables -
i'm reading book on operating systems , says "we must set things portion of added space allocated global variables tensions allocated life time of program, portion allocated local variable remains allocated while thread in variables scope"
what don't understand when program loaded memory isn't addresses reserved static? it's not when variable goes out of scope operating system sees address space variable (is?) @ can used program now, or it?
the book says global variables stored in memory , local variables stored in run time stack. first of run time stack in memory don't see distinction. how operating system know how space allocate run time stack since number of items pushed on can't determined before runtime?
when book says "global variables stored in memory", referring heap, different stack. both memory different types of memory.
see here more details: http://www-ee.eng.hawaii.edu/~tep/ee160/book/chap14/subsection2.1.1.8.html
Comments
Post a Comment