title: Do stack and heap memory both refer to the RAM(Assume no paging is being used)?
body: <p>I am currently taking an operating systems course and I am at a point where we are discussing memory portion of a process. When a program is loaded into memory and thus becomes a process, two forms of memory could be used: either a stack data structure or a heap(I am not quite sure if it's called heap because it actually uses the heap data structure). I have already looked at this link <a href="https://stackoverflow.com/questions/25250808/do-the-stack-and-heap-both-exist-within-your-systems-ram">Do the Stack and Heap both exist within your systems RAM?</a> which helped me to a certain extent but did not actually answer my question.</p>
  
  <p>Now my question is: </p>
  
  <p>Stack is the memory where local variables are stored. When a function is called, it is pushed on the stack along with all its variables and when it returns it is popped of the stack. It is kind of a temporary memory. For the heap, there is more control on the memory since once allocated, the memory allocated stays there until explicitly freed. However, are we talking about RAM when we refer to stack and heap? Is the stack and heap of a process A residing in the address space of process A in the RAM?</p>
  
  <p>I know that due to paging that is not always the case because the OS could do efficient memory management and put some memory on the disk while the process is not being used. Let us assume no paging is used just to isolate the two ideas and understand clearer what is happening in memory for a particular process.</p>