News for hackers. Stuff that matters.
Re:Re: 100k Threads? (2002) by ori_b on Saturday September 23, 2023 @09:12AM (#37622942)
And, thankfully, newer computers have virtual memory and page tables, which means that allocating a large stack only costs one page of physical memory until you use it.
Re:Re: 100k Threads? (2002) by fulafel on Saturday September 23, 2023 @09:45AM (#37623158)
This was also the case in 2002.
Re:Re: 100k Threads? (2002) by amelius on Saturday September 23, 2023 @09:50AM (#37623200)
When will we see more dynamically allocated stacks? I'm still getting stack overflow errors on small problems running on my 64GB system, in various languages. This feels like how strings are allocated in old languages (like COBOL?), just fixed sizes for everything.
Re:Re: 100k Threads? (2002) by gpderetta on Saturday September 23, 2023 @11:13AM (#37623993)
Stacks dynamically grow, but there is usually a default upper bound (typically 8MB) to catch runaway recursion and other bugs before it start trashing memory. If you really need 64GB stacks you can set that bound. But do you really need huge stacks?
Re:Re: 100k Threads? (2002) by amelius on Saturday September 23, 2023 @01:10PM (#37625174)
> Stacks dynamically grow

I think that stacks grow using pagefaults, so you might still run out of address space.

I.e., you can't have two programs running where (arbitrarily) one of them consumes (nearly) all of your memory on a system where address space size equals memory size.