A stack is a data structure for storing items which are to be accessed in last-in first-out order. The operations on a stack are
to create a new stack,
to “push” a new item onto the top of a stack, and
to “pop” the top item off.
Error conditions are raised by attempting to pop an empty stack or to push an item onto a stack which has no room for further items (because of its implementation).
The runtime stack is a memory array managed directly by the CPU, and it is an essential part of the mechanism for calling and returning from procedures.
The ESP (Extended Stack Pointer) register holds a 32-bit offset into some location on the stack.
We rarely manipulate ESP directly; instead, it is indirectly modified by instructions such as CALL, RET, PUSH, and POP.
The following figures illustrate a series of stack operations: