In a portable way, e.g. calling pthread_attr_setstacksize https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2019r8.pdf https://github.com/JuliaLang/julia/issues/52707#issuecomment-1877185253 See e.g. this library, might be helpful: https://ztdthread.readthedocs.io/en/latest/