For fine-grained control, especially in multi-threaded C/C++ applications on POSIX systems (like Linux), the `pthread_attr_setstacksize` function allows developers to explicitly set the stack size for individual threads, overriding system defaults or linker settings.