I wonder if stack size can grow like heap does during runtime?
The amount of stack used certainly increases, as you allocate local variables and make function calls. Whether the stack's maximum size can grow is technically undefined, but in practice is generally constant. You can make the constant bigger with a flag to the OS, but usually each thread gets a certain size of stack. When you use too much, it's a stack overflow.
I think that the executable stack size is defind by the compiler/linker.. so you can change it but not on runtime. You can change the stack size of a thread. + everything is compiler and os specific, so there is no single answer here.
From what I can remember stacks generally operate under the assumption that they exist in a contiguous memory range. Basically the expect the next stack frame to be in the next bit of memory (this helps it run faster not having to do instruction look up). Like others have said it is possible but i don't think it is widely used.
The stack size actually allocated can grow on modern desktop operating systems.
In practice it is implemented in terms of the memory management unit. As memory is accessed beyond the current committed pages of the stack, new memory pages are committed in. Only the pages that are actually used (plus one guard page usually) are used in RAM. Maximum stack space can be controlled through system resource limits. For example on POSIX.1-2001 you can query the process maximum stack size with getrlimit()
.
On the other hand, old operating systems and many embedded systems, lacking a hardware-based memory management unit, do set a fixed limit on the stack size.
A thread's stack space is set by the compiler. My compiler will reserve 2Mb of space. And will commit 1 Mb.
Of course you can change your compilers default stack size, or you can start a new thread with a larger stack size by calling CreateThread. http://msdn.microsoft.com/en-us/library/ms682453%28VS.85%29.aspx