Wei*_*ier 9 memory swap process htop
当我运行 htop(在 OS X 10.6.8 上)时,我看到如下内容:
1 [||||||| 20.0%] 任务:总共 70 个,运行 0 个 2 [||| 7.2%] 平均负载:1.11 0.79 0.64 3 [||||||||||||||||||||||||81.3%] 正常运行时间:00:30:42 4 [|| 5.8%] 内存[||||||||||||||||||||3872/4096MB] 交换[0/0MB] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ 命令 284 501 57 0 15.3G 1064M 0 S 0.0 6.5 0:01.26 /Applications/Firefox.app/Contents/MacOS/firefox -psn_0_90134 437 501 57 0 14.8G 785M 0 S 0.0 4.8 0:00.18 /Applications/Thunderbird.app/Contents/MacOS/thunderbird -psn_0_114716 428 501 63 0 12.8G 351M 0 S 1.0 2.1 0:00.51 /Applications/Firefox.app/Contents/MacOS/plugin-container.app/Contents/MacOS/ 696 501 63 0 11.7G 175M 0 S 0.0 1.1 0:00.02 /System/Library/Frameworks/QuickLook.framework/Resources/quicklookd.app/Conte 38 0 33 0 11.1G 422M 0 S 0.0 2.6 0:00.59 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framewo 183 501 48 0 10.9G 137M 0 S 0.0 0.8 0:00.03 /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
如何让进程使用 GB 的 VIRT 内存并仍然使用 0MB 的交换?
VIRT与使用的内存(虚拟或其他)没有任何关系,但与使用的地址空间没有任何关系,这并不像您想象的那样相关。
Modern operating systems (including OSX) have a feature called demand paging which works by telling the operating system to map a certain region of virtual address space to a file (such as a shared library/DLL). It is only when a program tries to read those virtual addresses that the file is loaded into memory.
If those shared libraries are in fact shared, then the operating system will actually share the physical memory across multiple processes; That is to say that a great deal of those tens of gigabytes are not only file-backed libraries, but also the same file-backed libraries.
此外,如果需要暂存内存(用于数据;设置、位图、声音等),并且没有任何未使用的物理页面,操作系统实际上会丢弃这些文件支持区域的内容并将它们提供给您的应用程序. 如果再次需要这些页面,操作系统可以简单地从磁盘重新加载它们。
Swap ( SWP) 是该暂存内存的特殊文件支持区域。创建交换空间将允许操作系统将临时内存移动到磁盘而不是(由更多正在运行的进程使用)共享库,通常会提高性能,也许最令人惊讶的是,与根本没有交换空间相比,产生的交换更少.
| 归档时间: |
|
| 查看次数: |
22181 次 |
| 最近记录: |