Hacker News new | ask | show | jobs
by apoorvgarg 2808 days ago
Again, all this confusion is due to not being clear about virtual and physical memory. Every OS thread in linux does have a fixed virtual memory size (it is claimed when a thread is created, but this claim is on the virtual memory. This value is fixed at creation time). As you grow your program's conceptual stack in this virtual memory area, you would soon hit new pages of virtual memory, leading to page faults and linux allocating physical memory for you.

From a virtual memory standpoint, every thread would appear to have a fixed size which can be set when you create it. [0]

From a physical memory standpoint, every thread would appear to have a dynamic size (but bounded by the virtual memory size of course).

[0] http://man7.org/linux/man-pages/man3/pthread_create.3.html