Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the stack in memory actually a stack?

In memory there is a section called stack that starts at the top and grows down towards the heap. Is this stack the same thing as a LIFO stack? Is the heap at the bottom a FIFO?

When you do "push" and "pop", does that alter the stack in memory?

like image 892
node ninja Avatar asked Dec 22 '22 15:12

node ninja


1 Answers

The stack is in fact a LIFO stack.

It's created by the program itself while the program is running. The code that controls the stack is created at compilation time.

Farther reading:

Hardware Stacks

Call Stack

X86 Addressing Modes

like image 135
Yochai Timmer Avatar answered Dec 24 '22 03:12

Yochai Timmer