I am working on Pintos.
Which is sort of like an educational tool for learning about building operating systems, and am on the second project which is geared around building support for user programs.
So, first order of business is to Set up The Stack! Great.
Problem is - since the beginning of the class I've been shuddering at those words The Stack - because I can never quite get a grasp around what The Stack is and how it plays into the execution of a program or thread. So I understand it is an area of memory set up in RAM, but that's about it.
My questions are as follows:
- What is the function of the stack?
- How does "The Stack" play into the execution of a thread in the CPU, with respect to the Program Counter, Registers, and Stack Pointer?
- How are things added to the stack and how are they removed from it?
- Furthermore, even if you don't know about Pintos, what does it mean to "set up the stack" when building support for user programs in an operating system?