<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Os_memory on Yuchen You</title>
    <link>https://www.whoami-wesleyyou.top/tags/os_memory/</link>
    <description>Recent content in Os_memory on Yuchen You</description>
    <generator>Hugo</generator>
    <language>zh-CN</language>
    <lastBuildDate>Mon, 29 Sep 2025 13:19:27 +0800</lastBuildDate>
    <atom:link href="https://www.whoami-wesleyyou.top/tags/os_memory/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Memory Resource Management in VMware ESX Server</title>
      <link>https://www.whoami-wesleyyou.top/2025/09/29/computer_system_basics/os/historical/18.vmware_esx_mem/</link>
      <pubDate>Mon, 29 Sep 2025 13:19:27 +0800</pubDate>
      <guid>https://www.whoami-wesleyyou.top/2025/09/29/computer_system_basics/os/historical/18.vmware_esx_mem/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;VMware ESX Server is a thin software layer designed to multiplex hardware resources efficiently among virtual machines. The current system virtualizes the Intel IA-32 architecture&lt;/p&gt;
&lt;p&gt;In contrast, ESX Server manages system hardware directly, providing significantly higher I/O performance and complete control over resource management.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;machine addr: real hardware address&lt;/li&gt;
&lt;li&gt;physical addr: guest OS&amp;rsquo;s address&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pmap&lt;/code&gt;: data structure for each VM that maps physical addr to machine addr (ppn -&amp;gt; mpn)
&lt;ul&gt;
&lt;li&gt;注意这就是 EPT 的功能, 只是 2002 年 Intel 还没有 EPT 技术&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;reclamation-mechanisms&#34;&gt;Reclamation Mechanisms&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;每个虚拟机都会有一个 constant max size (Virtual Mem), 也就是一旦启动之后就不会变了&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;overcommit-过量使用后收回页替换机制&#34;&gt;Overcommit: 过量使用后收回页替换机制&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;如果出现 ESX 宿主机承诺了过量的内存页使用量, 就会出现问题: 如何回收? 如果使用基于 pmap 的额外页表机制, 就还要改一下接口, 也就是撤回的页必须以 (VM, Vaddr) 这样的 tuple 形式才能让 ESX 实现页的撤回, 也就是 &lt;strong&gt;Meta-level Page Replacement&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;但是 ESX/VMM 层并不能知道哪个页更适合 evict, 这只有 guest OS 才知道&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Double Paging Problem&lt;/strong&gt;: 这样设计也会导致 double paging 的问题, VMM 撤回了某个特定的 (VM, page), 但是该 VM 在同时也在对应 page 写入了新的内容, 这样就会出现 inconsistency&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;balloon-机制&#34;&gt;Balloon 机制&lt;/h3&gt;
&lt;p&gt;&lt;img alt=&#34;esx_balloon.png&#34; loading=&#34;lazy&#34; src=&#34;https://www.whoami-wesleyyou.top/images/esx_balloon.png&#34;&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
