[Tutor] following on
davea at davea.name
Tue Feb 19 02:10:12 CET 2013
On 02/18/2013 02:01 PM, Matthew Ngaha wrote:
> i sort of heard about a stack its a C/C++ thing i think?
A stack is fundamental to modern programming languages. The only two
machines I've used that didn't have a stack implemented at the machine
level were the CDC 6000 series, and the IBM 360. Both products of the 60's.
Processors like the Intel Pentium series have a stack microcoded into
their lowest level instruction set. When the processor itself is
calling a subroutine, the current address is pushed onto the stack, and
the return instruction pops it back off and jumps there. Other
instructions for manipulating it exist at the same level. Typically all
local variables in a function are stored in the current stack frame.
The stack makes recursive functions practical, at a minimum. Having
multiple stacks makes multithreading practical as well.
Recursion and multithreading was very tricky on the CDC, since it stored
return addresses right into the running code.
Usually a programming language will provide a stack-like data structure,
for manipulating data that needs similar behavior.
More information about the Tutor