简体   繁体   English

像堆栈这样的段使用需求分页吗?

[英]does segments like stack use demand paging?

I can get stack size via shell's ulimit -s , but I'm not sure whether all the virtual memory already locate on physical memory, in other words , is demand paging is used here?我可以通过 shell 的ulimit -s获取堆栈大小,但我不确定所有虚拟 memory 是否已经位于物理 memory 上,换句话说,这里使用了按需分页吗?

My rough guess is not because the max thread numbers per process is limited .我粗略的猜测不是因为每个进程的最大线程数是有限的 If the stack make use of demand paging, the number of threads can overcommit and the number should exist.如果堆栈使用请求分页,线程的数量可以过度使用,并且该数量应该存在。

I can get stack size via shell's ulimit -s, but I'm not sure whether all the virtual memory already locate on physical memory, in other words , is demand paging is used here?我可以通过 shell 的 ulimit -s 获取堆栈大小,但我不确定是否所有虚拟 memory 都已经位于物理 memory 上,换句话说,这里使用了按需分页吗?

Demand paging is used.使用请求分页。 Processes may never use huge fractions of the maximum stack space they are allowed and it would be pointless to waste precious physical memory that could be used as a disk cache for stack space that might never get used.进程可能永远不会使用它们允许的最大堆栈空间的大部分,浪费宝贵的物理 memory 是没有意义的,这些物理 memory 可以用作可能永远不会被使用的堆栈空间的磁盘缓存。

My rough guess is not because the max thread numbers per process is limited.我粗略的猜测不是因为每个进程的最大线程数是有限的。 If the stack make use of demand paging, the number of threads can overcommit and the number should exist.如果堆栈使用请求分页,线程的数量可以过度使用,并且该数量应该存在。

You are confusing the one and only process stack (used by the thread created when the process was created) with the stacks for threads created by the process after it is launched.您将唯一的进程堆栈(由创建进程时创建的线程使用)与进程在启动后创建的线程堆栈混淆。 They are different things.它们是不同的东西。 When a new thread is created, a new chunk of memory (totally unrelated to the stack of the thread that created the new thread) to hold its stack.当创建一个新线程时,一个新的 memory 块(与创建新线程的线程的堆栈完全无关)来保存它的堆栈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM