Stack size is a function of the operating system, although many earlier operating systems (for example, MSDOS) did not manage the segment of the program stack: it was a task to reserve a segment with the appropriate size.
In virtual memory and 32-bit APIs, the stack size is usually provided by the resource management mechanism. For example, on Linux, the ulimit command provides one source for controlling the size of the stack. Other levels of control are provided by mechanisms within the kernel that provide system policy, memory limits, and other restrictions.
source share