Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4 Probem- Heap vs. Stack Briefly address the following questions (2-3 sentences)

ID: 3598684 • Letter: 4

Question

4 Probem- Heap vs. Stack Briefly address the following questions (2-3 sentences): 1. Why can we not dynamically allocate objects on the stack? That way, we would avoid having to deal with the heap 2. Your language definition allows the runtime stack to contain at most one stack frame for each procedure at any point in time during program execution. Do you still need a runtime stack? 3. Could we change our runtime environment to allocate all stack frames on the heap? If yes, what are the advantages / disadvantages?

Explanation / Answer

Question 1

The size of the stack is attached with the program which contain sort of instructions in order to wrk.THough it is possible to change but once it is fixed it is diffcult to allocate memeory dynamically.

Question 2

The language defination allows the runtime stack to contain at most one stack frame for each procedure at any point in time during program execution.When compiled the stack is being fixed so at any point the stack frame is fixed for each procedure except beforehand it can be changed dynamically,

Question 3

Yes, we change our runtime environment to allocate all stack frames on the heap

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote