Questions tagged [stack]

A LIFO (Last In, First Out) data structure.

A LIFO (Last In, First Out) data structure.

Adding an element to a stack is referred to as "pushing", removing an element is referred to as "popping".

See: Wikipedia: Stack

79 questions
58
votes
7 answers

Why does the call stack have a static maximum size?

Having worked with a few programming languages, I've always wondered why the thread stack has a predefined maximum size, instead of expanding automatically as required.  In comparison, certain very common high level structures (lists, maps, etc.)…
Lynn
  • 846
12
votes
2 answers

Is a stack structure used for async processes?

This question has an excellent answer by Eric Lippert describing what the stack is used for. For year's I've known - generally speaking - what the stack is and how it's used, but parts of his answers make me wonder if this stack structure is…
jleach
  • 2,682
10
votes
2 answers

Limit of the stack

Recently I've tested the limit of a stack on three devices with different OSs (by limit, I mean the maximum number of levels that can the stack have), and I noticed that every time when I hit 2^16 levels it gives me overflow error, and when I put…
Anonymus
  • 211
4
votes
3 answers

Confusion of the "stack" in Assembly-level programming

What is the "stack" exactly? I've read articles, tried comprehending it through my understanding, experience, and educated guessing of programming and computers, but I'm a bit perplexed here. The "stack" is a region in RAM? Or is it some other…
4
votes
5 answers

Stack-instructions machines

When I look up "stack machine" I often get stuff like the JVM that uses a stack for data, but it still uses an array to store its instructions. I would like to find out more about machines whose programs are stacks. For example, executing the…
math4tots
  • 437