Denys Vlasenko <vda.linux@googlemail.com> writes:>> Forget about 50k threads. 4k of waste per process is a waste nevertheless.> It's not at all unusual to have 250+ processes, and 250 processes with 8k> stack each waste 1M. Do you think extra 1M won't be useful to have?

If the 1M gives you more reliability (and I think it does) I don't think it is "wasted". Would you trade occasional crashes for 1MB? I wouldn't.

Also a typical process uses much more memory than just 4K. If it'snot a thread it needs own page tables and from those alone you'reeasily into 10+ pages even for a quite small process. But even threadsin practice have other overheads too if they actually do something.The 4K won't save or break you.

[BTW if you're really interested in saving memory there are lotsof other subsystems where you could very likely save more. A commonexample are the standard hash tables which are still too big]

The trends are also against it: kernel code is getting more and morecomplex all the time with more and more complicated stacks ofdifferent subsystems on top of each other. It wouldn't surprise me ifat some point 8KB isn't even enough anymore. Going into theother direction is definitely the wrong way.-Andi