This patent application is based on and claims priority under 35 U.S.C. §119 to Japanese Patent Application No. 2006-252287, filed on Sep. 19, 2006, in the Japanese Patent Office, the disclosure of which is hereby incorporated herein by reference.
Example embodiments of the present invention relate to memory management, and more specifically to an apparatus, method, system, computer program and product each capable of managing memory in a virtualization system.
The use of virtual machine software, such as hypervisor software, allows a plurality of domains to simultaneously run on a single physical apparatus. For example, as illustrated in
However, when more than one domain executes the same operating system, more than one copy of the operating system will be loaded in a physical memory of the physical apparatus, thus the physical memory space is not efficiently used.
Example embodiments of the present invention include an apparatus, method, system, computer program and product each capable of managing memory in a virtualization system.
In one example, a virtualization system including a hypervisor may be provided in a physical apparatus. The hypervisor may generate a plurality of domains that simultaneously operate on the physical apparatus including at least two domains each of which may execute an operating system. The hypervisor may generate a page fault exception upon detecting an attempt to access a selected page of the operating system. When it is determined that the selected page is not present in a physical memory of the apparatus, the hypervisor may load the selected page of the operating system from a secondary memory of the apparatus into a flame of the physical memory having a physical address. When it is determined that the selected page is present in the physical memory of the apparatus, the hypervisor may obtain the physical address of the flame of the physical memory to which the selected page is loaded. The hypervisor may store mapping information indicating the correspondence between the selected page of the operating system and the physical address of the flame to which the selected page of the operating system is loaded. Further, the hypervisor may set a state of the selected page of the operating system to a read-only state.
In addition to the above-described example embodiments, the present invention may be practiced in various other ways.
A more complete appreciation of the disclosure and many of the attendant advantages and features thereof can be readily obtained and understood from the following detailed description with reference to the accompanying drawings, wherein:
The accompanying drawings are intended to depict example embodiments of the present invention and should not be interpreted to limit the scope thereof. The accompanying drawings are not to be considered as drawn to scale unless explicitly noted.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “includes” and/or “including”, when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
In describing example embodiments shown in the drawings, specific terminology is employed for the sake of clarity. However, the present disclosure is not intended to be limited to the specific terminology so selected and it is to be understood that each specific element includes all technical equivalents that operate in a similar manner.
Referring now to the drawings, wherein like reference numerals designate identical or corresponding parts throughout the several views,
The hypervisor 210 may be implemented by hypervisor software capable of generating one or more domains to allow more than one domain, or more than one virtual machine, to simultaneously run on the hardware platform 250. The hypervisor 210 includes a domain generator 211 and a memory manager 212. The domain generator 211 generates one or more domains, each of which may run under any desired operating system, upon receiving a request from the control domain 220. The memory manager 212 manages allocation of portions of memory to the operating system of any one of the domains. Additionally, the memory manager 212 may manage information to be used for address translation, such as mapping information indicating the correspondence between a page of the operating system and a flame of a physical memory to which the page of the operating system is loaded.
The control domain 220, which is created first by the hypervisor 210 upon activation, includes a control domain OS 221, and a control program 222 that runs under the control domain OS 221. The control domain 220 may cause the hypervisor 210 to create one or more domains as needed by sending a request to the domain generator 211 as described below referring to
The hardware platform 250 includes any desired kind of hardware resources including, for example, a central processing unit (CPU) 251, a random access memory (RAM) 252, and a hard disk drive (HDD) 253. The CPU 251 may be implemented by any desired kind or any desired number of processor. The RAM 252 may be implemented by any desired kind of volatile or nonvolatile memory. The HDD 253 may be implemented by any desired kind of nonvolatile memory capable of storing a large amount of data. The hardware resources may additionally include an input device, an output device, or a network device, depending on the type of the apparatus. Alternatively, the HDD 253 may be provided outside of the apparatus as long as the HDD 253 is accessible. In this example, the CPU 251, such as a cache memory of the CPU 251, and the RAM 252 may function as a physical memory 410 (
Referring now to
In order to create the first domain 230, at S201, the control program 222 sends a request for creating a new domain to the domain generator 211 of the hypervisor 210 via the control domain OS 221. Upon receiving the request, at S202, the domain generator 221 creates the first domain 230, which runs under an operating system A (OS-A) 231. In a substantially similar manner, at S301, the control program 222 sends a request for creating a new domain to the domain generator 221 of the hypervisor 210 via the control domain OS 221. Upon receiving the request, at S302, the domain generator 221 creates the second domain 240, which runs under an operating system A (OS-A) 241. In this example, the OS-A 231 to be executed in the first domain 230 and the OS-A 241 to be executed in the second domain 240 are assumed to be the same operating system. For this reason, the OS-A 231 and the OS-A 241 may be collectively referred to as the “OS-A”.
When the OS-A is executed, a process or a task may be started. For example, as illustrated in
Referring now to
In this example, the memory manager 212 of the hypervisor 210 may cause a selected portion of the OS-A 231 to be loaded into the physical memory 410 only when an attempt to access the selected portion of the OS-A 231 is detected. Similarly, the memory manager 212 of the hypervisor 210 may cause a selected portion of the OS-A 241 to be loaded into the physical memory 410 only when an attempt to access the selected portion of the OS-A 241 is detected.
As illustrated in
In order to cause the selected page of the OS-A to be loaded upon detecting the attempt to access the selected page of the OS-A, a page table entry (PTE) of the page table may be previously set to an invalid state. When the PTE corresponding to the domain address of the selected page of the OS-A is accessed, a page fault exception may be generated to invoke the hypervisor 210, while interrupting the current operation of accessing the selected page.
Upon detecting the attempt to access the selected page of the OS-A, or upon detecting the page fault exception, the memory manager 212 of the hypervisor 210 may determine whether the selected page of the OS-A has been loaded from the secondary memory 420 into the physical memory 410, for example, by checking the PTE of the page table that stores flag information indicating whether the selected page is present in the physical memory 410. When it is determined that the selected page of the OS-A has not been loaded, the memory manager 212 assigns the selected page of the OS-A with a flame having a specific physical address, and loads the selected page of the OS-A, which is stored at a specific address of the secondary memory 240, into the assigned flame of the physical memory 410.
Further, in this example, the hypervisor 210 may manage the mapping information indicating the correspondence between the selected page of the OS-A and the flame of the physical memory 410 to which the selected page is loaded. For example, the hypervisor 210 may manage the mapping information indicating the correspondence between the domain address assigned to the selected page of the OS-A and the physical address assigned to the flame to which the selected page of the OS-A is loaded. In the above-described example case, when it is determined that the selected page of the OS-A has not been loaded from the secondary memory 420 into the physical memory 410, the memory manager 212 may update the page table such that the physical address being assigned by the hypervisor 210 is stored in a corresponding manner with the domain address of the selected page of the OS-A.
Alternatively, in the above-described example case, when it is determined that the selected page of the OS-A has been loaded into the physical memory 410, the memory manager 212 may obtain a physical address previously assigned to the flame to which the selected page of the OS-A has been loaded, for example, from the page table. The memory manager 212 may further update the mapping information stored in the page table such that the selected page of the OS-A may be shared by one domain, specifically by associating the physical address being obtained with the domain address of the selected page of the OS-A that is accessed. This prevents the page of the OS-A that has been loaded into the flame of the physical memory 410 to be loaded again into another flame of the physical memory 410.
As described above referring to
Further, a selected page of the OS-A may be loaded from the secondary memory 420 into the physical memory 410 only when the selected page of the OS-A is not loaded into a corresponding flame of the physical memory 410. For example, as illustrated in
Referring now to
Referring to
Since the PTE of the page table is previously set to the invalid state, at S602, a page fault exception is generated when the PTE corresponding to the domain address assigned to the page 313 of the OS-A 231 is accessed. When the page fault exception is generated, the hypervisor 210 is invoked while interrupting the operation of accessing the page 313.
S603 determines whether the page 313 has been loaded from the secondary memory 420 into the physical memory 410, for example, by checking the flag information obtainable from the page table. When it is determined that the page 313 has been loaded (“YES” at S603), the operation proceeds to S605. When it is determined that the page 313 has not been loaded (“NO” at S603), the operation proceeds to S604.
S604 assigns the page 313 with a flame 413 (
At S605, the hypervisor 210 updates the page table with mapping information indicating the correspondence between the page 313 of the OS 231 and the flame 413 of the physical memory 410.
At S606, the hypervisor 210 may set the state of the page 313 to a read-only state, for example, by changing the state of the flag information of the page table. The flag information may indicate whether the page is read only (read-only state) or the page can be read and written into (read-write state). By setting the page 313 to the read-only state, a protection fault exception may be generated when an attempt to write into the page 313 is detected as described below referring to
S607 returns to the interrupted operation to allow the OS-A 231 to access the page 313, and the operation ends.
As described above referring to
Referring to
Since the selected page 323 is set to the read-only state, at S702, a protection fault exception is generated to invoke the hypervisor 210, while interrupting the operation of writing into the page 323.
S703 assigns a flame 412 (
S704 updates the page table with the mapping information indicating the correspondence between the page 323 and the flame 412 of the physical memory 410, and the correspondence between the page 314 and the flame 411 of the physical memory 410.
S705 sets the state of the page 323 to a read-write state, for example, by changing the state of the flag information. By setting the page 323 to the read-write state, the page 323 can be written into.
S706 returns to the interrupted operation to allow the OS-A 241 to write into the page 323, and the operation ends.
The mapping information, which may be managed by the hypervisor 210, may be used for address translation of a process or a task. Referring now to
For example, referring to
Once the domain address is obtained, the hypervisor 210 may convert the domain address to the corresponding physical address, for example, using the page table described above referring to
Using the domain page table in addition to the physical page table, the hypervisor 210 may manage the mapping information indicating the correspondence of a virtual address, domain address, and physical address. For example, based on information obtainable from the domain and physical page tables, the hypervisor 210 may create a CPU page table storing the mapping information indicating the correspondence between the virtual address and the physical address as a CPU page table to be used by the CPU. The mapping information stored in the CPU page table may be managed by the hypervisor 210, for example, as described below referring to
Referring now to
For example, when a domain page table, or the mapping information indicating the correspondence between the virtual address and the domain address, has been updated, the OS that manages the domain page table generates a hypercall, which requests the hypervisor 210 to update the mapping information stored in the CPU page table. Upon detecting the hypercall, the hypervisor 210 updates the CPU page table with the mapping information obtainable from the OS.
Numerous additional modifications and variations are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims, the disclosure of the present invention may be practiced otherwise than as specifically described herein.
For example, elements and/or features of different illustrative embodiments may be combined with each other and/or substituted for each other within the scope of this disclosure and appended claims.
Further, as described above, the virtualization system 200 may be provided in any desired apparatus. Referring now to
Referring to
Further, as described above, any one of the above-described and other methods of the present invention may be embodied in the form of a computer program stored in any kind of storage medium. Examples of storage mediums include, but are not limited to, flexible disk, hard disk, optical discs, magneto-optical discs, magnetic tapes, involatile memory cards, ROM (read-only-memory), etc.
Alternatively, any one of the above-described and other methods of the present invention may be implemented by ASIC, prepared by interconnecting an appropriate network of conventional component circuits or by a combination thereof with one or more conventional general purpose microprocessors and/or signal processors programmed accordingly.
Number | Date | Country | Kind |
---|---|---|---|
2006-252287 | Sep 2006 | JP | national |