mmap会使用用户CPU而不是整个系统CPU吗? (索拉里斯)
当使用mmap分配一些匿名mem时,我们经常将起始地址设置为0/null,这样mmap会自己计算出起始地址。 为了获得起始地址,它将在整个虚拟内存空间中寻找一个可以放置要分配的内存卡盘的孔。 我猜这是按用户 cpu 而不是系统 cpu 计算的。 如果虚拟内存是碎片化的,那么查找起始地址的时候会占用更多的用户cpu,我的理解是否正确
when use mmap to allocate some anonymous mem, we often set the start address as 0/null so mmap will figure out the starting address by itself. And to get the start address, it will work thought the whole virtual memory space to find a hole which could put the chuck of mem to be allocated. I guess this is calculated as user cpu instead of sys cpu. If the virtual memory is fragmented, then the time to find the starting address will use more user cpu, is my understanding correct
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是不正确的。 mmap 系统调用所花费的时间计为系统时间。 不过,找到足够大的地址空间窗口并设置映射的时间应该是微不足道的。
I don't think this is correct. Time spent in the mmap system call is counted as system time. The time to find a large enough window of address space and set up the mappings should be trivial, though.