Difference between revisions of "Stack"

From Computer History Wiki
Jump to: navigation, search
m (avoid redir)
m (Ooops)
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
Stacks are usually stored in [[main memory]], but in some modern machines with many [[register]]s, the top of the stack (or a [[cache]] of the top) may be held in them.
 
Stacks are usually stored in [[main memory]], but in some modern machines with many [[register]]s, the top of the stack (or a [[cache]] of the top) may be held in them.
  
Modern [[Central Crocessing Unit|CPU]]s generally dedicate one [[register]] to be a [[stack pointer]], to point to the top of the stack; and instructions usually have [[addressing mode]]s which allow source [[operand]]s to be popped ''from'' the stack, and the destination of the result to be a push ''onto'' the stack.
+
Modern [[Central Processing Unit|CPU]]s generally dedicate one [[register]] to be a [[stack pointer]], to point to the top of the stack; and instructions usually have [[addressing mode]]s which allow source [[operand]]s to be popped ''from'' the stack, and the destination of the result to be a push ''onto'' the stack.
 +
 
 +
==See also==
 +
 
 +
* [[Call stack]]
 +
 
 +
{{semi-stub}}
 +
 
 +
[[Category: CPU Basics]]
 +
[[Category: Software Basics‎‎]]

Latest revision as of 15:20, 15 December 2018

A stack is a area of storage which is used to temporarily hold data in a 'push-down' fashion; i.e. data can be pushed onto the stack, and then popped off of it (in the reverse order from which it was pushed) when it is needed. (E.g. a 'push' of item A, and then B, would then be followed by a 'pop' of B, then A.)

Stacks are usually stored in main memory, but in some modern machines with many registers, the top of the stack (or a cache of the top) may be held in them.

Modern CPUs generally dedicate one register to be a stack pointer, to point to the top of the stack; and instructions usually have addressing modes which allow source operands to be popped from the stack, and the destination of the result to be a push onto the stack.

See also