Where is the STACK stored?

The question arose while studying the architecture of the PC. What type of memory does the stack belong to? Stack is an abstract data type says wiki, but not a word about where it is stored. I came to the point that the stack can be either a universal register or created in RAM, but RAM is not designed for the same. Who knows can share knowledge, and the question does not give rest

 0
Author: Volodymyr Samoilenko, 2016-05-26

1 answers

If you are talking about the stack as a storage of procedure parameters and their local variables, then yes, it is stored in RAM, where else?

If you are talking about a stack as a data structure available in some languages, then the storage location is a stack in the sense of the previous paragraph, or a heap, depending on many factors. For example, std::stack from C++ is stored, like any object, where it is allocated, but it most likely stores its data in the heap. In any case, this is also in the RAM.

Finally, if we talk about the stack as an abstract data structure, then its implementation can be stored anywhere - for example, in the file system. It depends only on the desire of the developer of the implementation.

 3
Author: VladD, 2016-05-26 23:18:19