2 ms·
1MB is about the lowest memory usage you can get on Windows 7, because of reasonable tradeoffs made in the operating system to things like buffer and stack size
by inigyou 3mo ago
1MB is about the lowest memory usage you can get on Windows 7, because of reasonable tradeoffs made in the operating system to things like buffer and stack sizes. The OS creates a few threads for you, those threads have stacks and they didn't optimize the allocation size of those stacks - they used a currently reasonable default.
- vlovich123 3mo agoDepends on the app/framework but typically phantom threads don’t get started. Also, those stacks aren’t materialized until you write something - they’re all CoW’ed pages from a sentinel 0-filled page the kernel keeps around just for this purpose.
- dwattttt 3mo agoIt's been a while, but I believe Windows initialises an internal thread pool & parallelises (some parts of) process start / module loading
- vlovich123 3mo agoYou’re right. I hadn’t realized that Windows creates a hidden thread pool under the hood for parallelized DLL loading.
- ack_complete 3mo agoThe stacks are allocated gradually, but there's a minimum few committed pages for each thread and there can be a lot of threads. The graphics driver alone will typically spawn a thread per CPU core unless you specifically disable threading optimizations, and that's separate from the thread pool.