size of stack and heap

  1. DUMBVM considers 18 pages (72K) as the maximum stack size, what should be the size of stack in our VM.
  2. To check if an address is present (inside vm_fault() ) in heap is it ok to check if its between start of heap and max stack address (Bottom of stack)?
  1. We no longer care what DUMBVM thinks. Keep changing your stack size until stacktest passes, basically. You may need to operate on the scale of MB.

  2. Your heap should have a defined size at any given time and shouldn’t just be “all the space between the final region and the stack”. There is a possible implementation I can dream up that might be able to work that way but I don’t recommend it.


As a related question, how will os161 expand the stack? Should out implementation simply have a static stack size or is possible to dynamically allocate stack pages so we can theoretically have an infinite stack?


It is typical for stacks to have static sizes, and this should be no exception. You should have a stack region defined by as_define_region. However, even though you have an entire region defined, the allocated portion will only be as many pages as needed at any given time.

The heap is different, as that segment can dynamically grown and shrink in size at run time.


General discussion regarding the segment sizes, sizes, and allocations for os161 – see “More on Memory Segments” from

1 Like