Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hm, isn't that "random idea" the conventional way of assigning thread stacks? Just carve out a piece of virtual address space, and put the stack pointer there. OS maps in memory when the application actually touches the pages. This works great for 64 bit systems. (the difference with your idea is that the memory is never unmapped / returned to the system unless the thread dies)


I realise all user space memory is at some point allocated using a virtual memory mapping. I'm not so sure that explicitly reserving pages which aren't committed is the conventional way to allocate stacks for new threads. In any case, if you don't explicitly purge the pages, a thread will end up using a lot more stack space than necessary if it required a large stack early on in its lifetime.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: