Can RAM be conceptually divided into 'stack' and 'heap memory'?

632 views Asked by At

I have been reading up on how processes are implemented by computers, and found mention of stacks and heaps. This was pretty cool to me, since a lack of any kind of computer science background means that these things have been pretty esoteric to me.

My current understanding is that, on an extremely basic level, a process is represented in RAM as a fix-sized 'Stack' and associated variably-sized data structures that collectively are known as 'heap' space. Frames are added to the stack that may result in creating, editing or deleting data stored in heap space thereby changing a processes 'state').

So my question is, can all RAM usage be categorized either as being part of a heap or part of a stack?

What else could be stored in RAM that doesn't fall into either of these categories?

1

There are 1 answers

6
Alexey Frunze On BEST ANSWER

Yes, in extremely simple systems, especially old and not supporting multitasking, all user memory can be used by a combination of user code, user data, user heap data, user stack data. It's up to the programmer what to use memory for. The memory doesn't mind. But, naturally, there needs to be code and, in most cases, stack. Everything else is optional.