Free What the OS does lessonsWhat the OS does · Stage 1 · Programs and processes · Step 2
What's in a process's memory
See the regions of a process's address space (code, data, heap, stack) and where each kind of variable lives. About 12 minutes.
Where does the local variable int total = 0; declared inside a function live?
- AOn the stack, in that call's frame
- BOn the heap
- CIn the data region, with the globals
Show the answer
On the stack, in that call's frame. Locals are created when the function is called and discarded when it returns.
4 questions on this idea
Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.
Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve