Sean Kelly wrote:
Georg Wrede wrote:
Andrei Alexandrescu wrote:

You can't have a stack smaller than 16KB as far as I understand. I seem to recall the default stack size is much bigger.

Totally not having researched this... The page http://www.unix.com/high-level-programming/34632-how-find-out-stack-size-occupied-process.html states that "Most Linux systems have no stack limits set" (didn't have time to find a definitive reference, yet).

One thing I don't understand is how the OS can manage essentially unbounded stack growth in a multithreaded program with a flat address space. Is it simply that the physical memory for each stack is mapped into the same virtual address space when a context switch occurs? And if so, how does this work with multiple cores? The only alternative I can think of would be to dedicate a virtual address range to each stack, which would set a definite upper bound on the stack size for each thread, and wasted/unused memory between stacks.

Well, unbounded and unbounded. It just means there's no set value. The stack can grow as long as there is space. And the virtual address range is more than there's physical memory, so I guess they can say no limit.

Reply via email to