WO2017044124A1 - Switch process virtual address space - Google Patents

Switch process virtual address space Download PDF

Info

Publication number
WO2017044124A1
WO2017044124A1 PCT/US2015/049726 US2015049726W WO2017044124A1 WO 2017044124 A1 WO2017044124 A1 WO 2017044124A1 US 2015049726 W US2015049726 W US 2015049726W WO 2017044124 A1 WO2017044124 A1 WO 2017044124A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual address
address space
vas
processor
instructions
Prior art date
Application number
PCT/US2015/049726
Other languages
French (fr)
Inventor
Izzat EL HAJJ
Alexander M. MERRITT
Gerd ZELLWEGER
Dejan S. Milojicic
Original Assignee
Hewlett Packard Enterprise Development Lp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hewlett Packard Enterprise Development Lp filed Critical Hewlett Packard Enterprise Development Lp
Priority to PCT/US2015/049726 priority Critical patent/WO2017044124A1/en
Publication of WO2017044124A1 publication Critical patent/WO2017044124A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Definitions

  • VAS virtual address space
  • each process is provided a virtual address space (VAS) that spans the entire address space addressable by the architecture of the processor (e.g. a 32 bit processor has a 4 Gigabyte address space), although not all of that address space may be directly accessible by the process due to other constraints.
  • VAS virtual address space
  • certain address ranges within the VAS may be reserved for system functions (e.g. kernel space).
  • the virtual memory system may not implement the maximum address space supported by the processor (e.g. the virtual memory system may only support 30 address bits, limiting the VAS to 1 Gigabyte).
  • the address space for each process is virtual because the computing system may not actually include enough physical memory for every processes' address space to be loaded into physical memory at the same time.
  • the virtual memory system hides the fact that each processes' address space may not actually be loaded into the physical memory of the computing system by transparently swapping pages of each processes' address space between physical memory and some other storage (e.g. a swap file on disk).
  • FIG. 1 is an example of a device that may utilize the process virtual address space switch techniques described herein.
  • FIG. 2 depicts an example of switching a virtual address space according to the techniques described herein.
  • FIG. 3 is an example of a high level flow diagram for switching virtual address spaces, according to techniques described herein.
  • FIG. 4 is another example of a high level flow diagram for switching virtual address spaces, according to techniques described herein.
  • FIG. 5 is an example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein.
  • FIG. 6 is another example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein.
  • computing devices employing a virtual memory system may allow a process to include a VAS that exceeds the amount of physical memory in the device.
  • VAS virtual memory
  • systems are currently being developed with large amounts of physical memory, in some case, the amount of physical memory may exceed that which is available in the VAS.
  • a system supporting a 32 bit VAS defines the maximum address range as 4 Gigabytes. Physical memory exceeding 4 Gigabytes would not be addressable at any given moment in time by a process running on a computing device with such a VAS, regardless of how much physical memory was actually installed in the device.
  • a VAS may be created, stored, and deleted in the same way as any other first class entity, such as a file.
  • a process may include data (e.g. a pointer) indicating the process's current VAS. The data may then be changed to indicate a different VAS. Because the process is now associated with a different VAS, the effective address space has doubled. If additional address space is needed, additional virtual address spaces may be created.
  • a first and second process may each have a VAS.
  • the first process ma switch to the second process's VAS (or at ieast portions of the VAS) and thus will have access to the second processes VAS without requiring the complexity that accompanies memory segments shared between processes.
  • one process could simply switch to the other process's VAS, thus eliminating conflicts that may arise when mapping physical memory into two separate virtual address spaces.
  • VAS may also exist that is not currently associated with any process.
  • each VAS is a first class entity that may exist independently of a process
  • new mechanisms for accessing data resident in system memory may become available.
  • a VAS may be created to contain a dataset that is not associated with any process. When a process needs access to that dataset, the process may switch to the VAS associated with the dataset. Once the process no longer needs to access the data set, it may switch back to its original VAS.
  • FIG. 1 is an example of a device that may utilize the process virtual address space switch techniques described herein.
  • System 100 may include a device 1 10.
  • the device 1 10 may include a processor 120, a physical memory 130, and a non-transitory processor readable medium 140.
  • the device 1 10 may be a computing device, such as a server computer, a desktop computer, a laptop, a tablet, a smartphone. or any other suitable device.
  • the techniques described herein are not limited to any particular device and are usable in any device that includes a virtual memory system.
  • the device 1 10 may include a processor 120.
  • the processor may be of any type, such as a central processing unit (CPU), graphics processing unit (GPU), and application specific integrated circuit (ASIC), or any other suitable type of circuitry or device.
  • CPU central processing unit
  • GPU graphics processing unit
  • ASIC application specific integrated circuit
  • the techniques described herein are not limited to any particular type of processor, but rather are applicable to any processor thai may be utilized in a device that implements a virtual memory system,
  • the device 1 10 may also include a physical memory 130.
  • the physical memory may include dynamic random access memory (DRAM), static random access memory (SRAM), non-volatile random access memory
  • NVRAM such as rnemristor or phase change memory
  • the memory may be used to store processor executable instructions and data.
  • the techniques described herein are suitable for use with any type of memory that may be utilized by the processor 120.
  • the device 1 10 may also include a non-transitory processor readable medium 140.
  • the medium may contain thereon a set of instructions, which when executed by the processor 120, may cause the processor to implement the techniques described herein.
  • the medium may include virtual memory system instructions 142.
  • a virtual memory system may be used to abstract the physical memory of a device 1 10 from processes running on that device. Each process is provided an address space sized according to the constraints of the virtual memory system. Each process utilizes this address space and need not be aware of the actual physical memory 130 that is included in the device.
  • the medium 140 may also include virtual address space switch instructions 144.
  • the virtual address space switch instructions may allow the processor to switch a process's VAS from a first VAS to a second VAS, thus effectively increasing the amount of memory the process may access beyond the range defined by a single VAS.
  • the virtual address space switch instructions are described in more detail below and in conjunction with FIGS. 3 and 4.
  • a process 150 may be executing on device 1 10.
  • a process may be instructions and data that are executable b a processor to complete a task.
  • a database program running on the device 1 10 may be comprised of one or more processes.
  • a process runs under the control of an operating system and may have process state information. Included amongst the process state information may be data that defines the VAS of the process.
  • an operating system is any control software, including hypervisors and other supervisory software.
  • a process refers to anything that exists within a virtual address space, including virtual machines.
  • a process 150 may initially be associated with a first VAS 180-1 .
  • a VAS is used by the virtual memory system to make it appear to the process that the full address space of the device 1 10 is available to the process, even though the device may not be equipped with enough physical memory for the process's entire VAS to be loaded into physical memory.
  • a process may desire to access a different VAS.
  • the process may need more memory than is available in the VAS. in other cases, the process may wish to access data that is contained in the VAS of a different process. Regardless of the reason, the process may wish to switch from the first VAS 160-1 to a second VAS 180-2.
  • the techniques provided herein provide instructions executable by the processor to cause a process to switch from a first VAS 160-1 to a second VAS 160-2.
  • each process running on device 1 10 may include process state information 210.
  • the process state information may include the contents of registers contained within the processor, in a multiprocessing system, multiple processes may run on the same processor. When a particular process is not actively running, processor state information, such as the processor register contents may be saved.
  • the process state information may include a program counter (PC) which may indicate the current instruction being executed within the process.
  • PC program counter
  • Another piece of process state may include a pointer to the page table root for the process (PT ROOT PTR).
  • PT ROOT PTR pointer to the page table root for the process
  • a system including a virtual memory system may include a VAS with a defined range. As mentioned above, the range may be from 0 to the maximum supported by the virtual memory system. As shown in FIG. 2, VAS 220 has an address range from 0- AX. It should be understood that the particular value of MAX is unimportant. The VAS may be broken down into smaller units called pages. For example, one common page size is 4 Kilobytes. Thus, a 4 Gigabyte VAS address space may be divided into slightly more than 1 million pages.
  • Each page of the VAS may be represented by a page table entry, and those combinations of the page table entries for the entire VAS may be referred to as a page table structure.
  • FIG. 2 depicts a high level view of a page table structure 222-1 .
  • the page table structure is depicted as containing a root node 223-1 , intermediate nodes 224-1 , and leaf nodes 225-1 .
  • the leaf nodes may include the actual page table entries. It should be understood that the particular format of the page table structure is unimportant, but rather that the page table structure may have a root node from which all page table entries descend.
  • Each page table entry may include at least two pieces of information.
  • the first piece of information may be if the page is currently mapped to physical memory.
  • a virtual memory system hides the fact that all of a process's VAS may not be contained in physical memory from the process. If the page is not in physical memory, the page may be stored in some other storage area (e.g. disk).
  • the second piece of information may be the address in physical memory storing the page (assuming the first piece of information indicates the page is stored in physical memory), it should be understood that because the physical memory may not necessarily be as large as the VAS, the virtual ⁇
  • a process may wish to execute instructions or access data located at a specific virtual address.
  • the virtual memory system may receive the virtual address and access the page table structure pointed to by the process state information (e.g. the PT ROOT PTR).
  • the virtual memory system may traverse the structure to find the page table entry associated with the memory page containing the virtual address of interest. If the page is currently loaded into physical memory, the virtual memory system may return the address within the physical memory where the page is stored and the process may access the page in the physical memory. If the page is not currently in physical memory, a page fault occurs and control may be handed to the operating system.
  • the operating system may then load the page from storage (e.g. disk) into the physical memory (this process may involve clearing space for the page in the physical memory be selecting a page to evict from physical memory and store to disk). Once the page has been loaded into physical memory, the process can access the address.
  • the VAS may be defined by the page fable structure.
  • the page table structure was strictly associated with a process.
  • the structure is no longer tied to a given process, and the corollary is true as well; the process is no longer tied to a given page table structure.
  • the pointer to the page table root structure in the process state information 210 may be switched from the initial VAS to the new VAS.
  • the processor may include data associated with the first VAS in registers or in various levels of on processor caches. This data may need to be flushed to memory before switching from one VAS to another.
  • a process may wish to switch from a first VAS 220-1 to a second VAS 220-2.
  • the process may first prepare for the switch by flushing processor registers and caches to the memory, as needed, to ensure that data associated with the first VAS is not inadvertently stored in the second VAS should a flush occur after the switch of the VAS.
  • the processor may then update the page table root pointer of the process state information to point from the page table root 223-1 to page table root 223-2.
  • the VAS of the process then switches from VAS 220-1 to VAS 220-2. Because the each VAS is independent, the process has effectively increased the total size of its virtual address space. Furthermore, because the VAS spaces can exist independent of a process, the process gains access to the data stored in the VAS prior to the process switching to that VAS.
  • the previous example has been described in terms of switching the page table root pointer, it should be understood that this is not the only possible implementation.
  • the contents of the page table structure e.g. 222-1
  • the contents of the page table structure 222-1 may first be stored elsewhere (e.g. to disk, or in the address space of a different process, such as the operating system kernel).
  • the contents of the page table structure 222-1 may then be overwritten with the contents of a different page table structure, thus effectively changing the page table structure 222-1 without changing the page table root pointer.
  • page fables may not be used at ail.
  • Such systems may use segment registers and offset computations to define virtual address spaces.
  • the techniques for switching virtual address spaces are suitable for use regardless of the type of virtual memory system.
  • a VAS is treated as a first class entity and can be associated and / or disassociated with a process.
  • virtual address spaces are independent entities, this does not mean that portions of the VAS cannot be shared or duplicated between virtual address spaces.
  • a VAS may contain several portions that are effectively defined by the process.
  • the BSS, data, and text portions of a process generally define the instructions and variables that are executed by the processor and are the functional code portions of the process
  • a portion of the VAS may be set aside for the kernel portion of the operating system (e.g. allowing the process to make system calls).
  • additional portion of the VAS may be set aside for the stack.
  • the stack is a data structure used by the process to store temporary variables and return pointers, among other data.
  • the VAS may also include portions such as the heap, from which the process may allocate new memory within the virtual address space.
  • the VAS may also include memory mapped portions.
  • the portions of the VAS that are to be shared may simply be copied, in their entirety, from one VAS to the other.
  • the references to the portions may be duplicated.
  • the page table entries denoted by the reference characters A, B, and C represent the kernel, stack, and BSS, data, and text page table entries.
  • page table structure 222-1 , 222-2 those page table entries (A,B and C) can simply be duplicated in each page. Because the page table entries are associated with memory (either in physical memory or in storage), the second VAS 220-2 contains the same kernel, stack, and BSS, data, and text portions, without having to actually copy those portions.
  • the operating system or processor may provide an API or a new processor instruction to ensure the switch from the first VAS to the second VAS is safe.
  • the process may invoke a system call to inform the operating system to inform the operating system of the switch in VAS.
  • the operating system may then alter process state information in order to accurately track the VAS that is currently active for the process, in another example implementation, the processor may provide a special instruction to execute the switch.
  • the processor may be provided an identifier associated with the second VAS, and the processor would perform the switch in the page table roof pointer automatically, after state information is provided by the operating system.
  • FIG. 3 is an example of a high level flow diagram for switching virtual address spaces, according to techniques described herein.
  • the example flow diagram of FIG. 3 may be implemented as instructions contained on a non- transitory medium, such as instructions 144.
  • a request may be received from a process to switch from a first virtual address space to a second virtual address space.
  • the switch may be requested because the process needs access to more memory than can be addressed in a single VAS, or it may be for other reasons, such as a desire to access data contained in a VAS that is different than the one currently associated with the process.
  • the process state information may be modified to reflect the change from the first virtual address space to the second virtual address space.
  • the switch may be implemented by changing the page table root pointer for the process from a page table associated with the first virtual address space to a page table associated with the second virtual address space. Other implementations are described in further detail below, with respect to FIG. 4.
  • FIG. 4 is another example of a high level flow diagram for switching virtual address spaces, according to techniques described herein.
  • the example flow diagram of FIG. 4 may be implemented as instructions contained on a non-transitory medium, such as instructions 144.
  • a request to create the second virtual address space may be received.
  • a VAS is now a first class entity and may be created independently of a process.
  • the second virtual address space may be created.
  • creating a VAS may include creating a new page table structure to associate with the new VAS.
  • creation of a new VAS may include creating the contents of a page table structure.
  • access permissions for the first and second virtual address spaces may be defined.
  • read and write permissions for a virtual address may be defined and a given process's ability to access the VAS may depend on those permissions.
  • a given process's ability to access the VAS may depend on those permissions.
  • a VAS may be desired that a VAS is only writeabie by one process at a time.
  • a VAS may only be able to be deleted when no other process is using the VAS.
  • a request may be received from a process to switch from a first virtual address space to a second virtual address space, in block 425, the defined access permissions for the first and second virtual address space may be enforced. For example, if a given VAS should not be accessed by a given process based on the permission defined in block 415, the request to switch the process into the prohibited VAS may be denied in order to enforce the permissions.
  • the duplication may be an actual copy of the address spaces from one space to another or it may be a copy of the page table entries associated with that portion of the address space. Regardless of implementation, the duplication of the address space may allow the process to continue executing without interruption.
  • Blocks 435-460 represent possible actions performed when switching from one virtual address space to another. Not all blocks need be executed by ail implementations and the depiction is intended to be an example. Other possible implementations may execute different blocks. What should be understood is that the process switches from a first VAS to a second VAS.
  • the process state information may be modified to reflect the change from the first virtual address space to the second virtual address space.
  • the process moves to block 440.
  • the contents of a page table Instance associated with the process may be stored to a data store.
  • the contents may be associated with the first virtual address space
  • the contents of the page table instance may be replaced with contents associated with the second virtual address space.
  • a page table instance may be data structure corresponding to the page table structure described with respect to FIG. 2.
  • the process in block 450, may be disassociated from a first page table instance corresponding to the first virtual address space. In block 455, the process may be associated with a second page table instance corresponding to the second virtual address space.
  • a processor instruction may be executed to switch from the first to the second virtual address spaces.
  • the instruction may be a part of the processor instruction set.
  • the instruction may result from the process making a system call.
  • the switch from one VAS to the other may include flushing processor caches and updating process state information.
  • the second virtual address space may be maintained after the process has terminated.
  • a VAS is now a first class entity, meaning that it may exist separate from any process. Thus, a VAS may continue to exist even if it is no longer associated with a process.
  • a request to delete the second VAS may be received. Again, because the VAS is a first class entity, it may be deleted just as any other first class entity may be deleted, in block 475, the second virtual address space may be deleted. For example, deletion may include deletion of the page table instance associated with the second VAS.
  • FIG. 5 is an example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein, in block 510, a process executing on a processor may identify a desire to switch from a first virtual address space to a second virtual address space. As mentioned above, the process may determine the desire to switch to a different VAS in order to access memory beyond that which is available in a single VAS or the process may wish to access data contained in a different VAS.
  • the process may identify the desire to switch virtual address spaces.
  • an identifier for the second virtual address space may be obtained.
  • an identifier associated with the second VAS may be used to particuiariy identify the address space to which the process will switch.
  • a process may request, from an operating system running on the processor, a switch from the first virtual address space to the second virtual address space.
  • the process may simply identify the VAS to switch to (e.g. using the identifier) and then request the operating system to switch the process form the first VAS to the second VAS.
  • the particular details of the switching process may be transparent to the process itself.
  • FIG. 6 is another example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein, in block 805, creation of the second virtual address space may be requested.
  • a VAS is now treated as a first class entity, and as such, can be created independent of any process.
  • the techniques described provide for the ability to request creation of a new VAS.
  • an identifier associated with the created second virtual address space may be received.
  • a VAS may be identified through the identifier.
  • the identifier may be created as part of the creation of a VAS.
  • the identifier may then be sent to the process that requested creation of the second VAS, such that process is able to identify the created second VAS.
  • a process executing on a processor may identify a desire to switch from a first virtual address space to a second virtual address space.
  • the desire may stem from a desire to access memory beyond that which is accessible in a single VAS or it may stem from a desire to access data that is stored in a different VAS.
  • an identifier for the second VAS may be obtained.
  • the identifier may be the identifier that was received in block 810 in the case that the VAS has been newly created.
  • the identifier may be associated with a VAS that was previously created. Regardless of when created the identifier may identify the VAS to which the process will switch.
  • the process may request from an operating system running on the processor a switch from the first virtual address space to the second virtual address space.
  • the process may request deletion of the second virtual address space.
  • the VAS is treated as a first class entity meaning that it can be created independently of a process.
  • a VAS can be deleted independent of a process being destroyed.
  • deletion of the VAS may be requested, thus freeing up any resources being used to maintain the VAS to be deleted.
  • resources may include page table structures or storage space used to store the data contained in page fable structures.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

Techniques for a process to switch virtual address spaces are provided, in one aspect, a request to switch from a first virtual address space to a second virtual address space may be received from a process. Process state information may be modified to reflect the change from the first virtual address space to the second virtual address space.

Description

SWITCH PROCESS VIRTUAL ADDRESS SPACE BACKGROUND
[0001] The majority of modern computing systems include a virtual memory system. In a virtual memory system computing device, each process is provided a virtual address space (VAS) that spans the entire address space addressable by the architecture of the processor (e.g. a 32 bit processor has a 4 Gigabyte address space), although not all of that address space may be directly accessible by the process due to other constraints. For example, certain address ranges within the VAS may be reserved for system functions (e.g. kernel space). In some cases, the virtual memory system may not implement the maximum address space supported by the processor (e.g. the virtual memory system may only support 30 address bits, limiting the VAS to 1 Gigabyte).
[0002] The address space for each process is virtual because the computing system may not actually include enough physical memory for every processes' address space to be loaded into physical memory at the same time. The virtual memory system hides the fact that each processes' address space may not actually be loaded into the physical memory of the computing system by transparently swapping pages of each processes' address space between physical memory and some other storage (e.g. a swap file on disk).
BRIEF DESCRIPTION OF THE DRAWINGS
[0003] FIG. 1 is an example of a device that may utilize the process virtual address space switch techniques described herein.
[0004] FIG. 2 depicts an example of switching a virtual address space according to the techniques described herein. [0005] FIG. 3 is an example of a high level flow diagram for switching virtual address spaces, according to techniques described herein.
[0006] FIG. 4 is another example of a high level flow diagram for switching virtual address spaces, according to techniques described herein.
[0007] FIG. 5 is an example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein.
[0008] FIG. 6 is another example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein.
DETAILED DESCRIPTION
[0009] As mentioned above, computing devices employing a virtual memory system may allow a process to include a VAS that exceeds the amount of physical memory in the device. However, systems are currently being developed with large amounts of physical memory, in some case, the amount of physical memory may exceed that which is available in the VAS. As a simple example, a system supporting a 32 bit VAS defines the maximum address range as 4 Gigabytes. Physical memory exceeding 4 Gigabytes would not be addressable at any given moment in time by a process running on a computing device with such a VAS, regardless of how much physical memory was actually installed in the device.
[0010] The techniques described herein overcome this shortcoming by treating a VAS as a first class entity, thus decoupling the VAS from a given process. A VAS may be created, stored, and deleted in the same way as any other first class entity, such as a file. A process may include data (e.g. a pointer) indicating the process's current VAS. The data may then be changed to indicate a different VAS. Because the process is now associated with a different VAS, the effective address space has doubled. If additional address space is needed, additional virtual address spaces may be created.
[0011] Furthermore, by treating a VAS as a first class entity, new types of memory sharing may be made possible. For example, a first and second process may each have a VAS. The first process ma switch to the second process's VAS (or at ieast portions of the VAS) and thus will have access to the second processes VAS without requiring the complexity that accompanies memory segments shared between processes. For example, there would no longer be a need to manage virtual address conflicts between the first and second VAS. Instead, one process could simply switch to the other process's VAS, thus eliminating conflicts that may arise when mapping physical memory into two separate virtual address spaces. When reference to a process's VAS is made, this means to the VAS currently associated with the process.
However, it should be understood that a VAS may also exist that is not currently associated with any process.
[0012] In addition, because each VAS is a first class entity that may exist independently of a process, new mechanisms for accessing data resident in system memory may become available. For example, a VAS may be created to contain a dataset that is not associated with any process. When a process needs access to that dataset, the process may switch to the VAS associated with the dataset. Once the process no longer needs to access the data set, it may switch back to its original VAS.
[0013] FIG. 1 is an example of a device that may utilize the process virtual address space switch techniques described herein. System 100 may include a device 1 10. The device 1 10 may include a processor 120, a physical memory 130, and a non-transitory processor readable medium 140. The device 1 10 may be a computing device, such as a server computer, a desktop computer, a laptop, a tablet, a smartphone. or any other suitable device. The techniques described herein are not limited to any particular device and are usable in any device that includes a virtual memory system.
[0014] The device 1 10 may include a processor 120. The processor may be of any type, such as a central processing unit (CPU), graphics processing unit (GPU), and application specific integrated circuit (ASIC), or any other suitable type of circuitry or device. The techniques described herein are not limited to any particular type of processor, but rather are applicable to any processor thai may be utilized in a device that implements a virtual memory system,
[0015] The device 1 10 may also include a physical memory 130. The physical memory may include dynamic random access memory (DRAM), static random access memory (SRAM), non-volatile random access memory
(NVRAM), such as rnemristor or phase change memory, or any other suitable form of memory. The memory may be used to store processor executable instructions and data. The techniques described herein are suitable for use with any type of memory that may be utilized by the processor 120.
[0016] The device 1 10 may also include a non-transitory processor readable medium 140. The medium may contain thereon a set of instructions, which when executed by the processor 120, may cause the processor to implement the techniques described herein. For example, the medium may include virtual memory system instructions 142. As mentioned previously, a virtual memory system may be used to abstract the physical memory of a device 1 10 from processes running on that device. Each process is provided an address space sized according to the constraints of the virtual memory system. Each process utilizes this address space and need not be aware of the actual physical memory 130 that is included in the device.
[0017] The medium 140 may also include virtual address space switch instructions 144. The virtual address space switch instructions may allow the processor to switch a process's VAS from a first VAS to a second VAS, thus effectively increasing the amount of memory the process may access beyond the range defined by a single VAS. The virtual address space switch instructions are described in more detail below and in conjunction with FIGS. 3 and 4.
[0018] In operation, a process 150 may be executing on device 1 10. As is explained in more detail below, a process may be instructions and data that are executable b a processor to complete a task. For example, a database program running on the device 1 10 may be comprised of one or more processes. A process runs under the control of an operating system and may have process state information. Included amongst the process state information may be data that defines the VAS of the process. Although the description refers to operating systems, it should be understood that an operating system is any control software, including hypervisors and other supervisory software. Likewise, a process refers to anything that exists within a virtual address space, including virtual machines.
[0019] A process 150 may initially be associated with a first VAS 180-1 . As mentioned above a VAS is used by the virtual memory system to make it appear to the process that the full address space of the device 1 10 is available to the process, even though the device may not be equipped with enough physical memory for the process's entire VAS to be loaded into physical memory.
[0020] A process may desire to access a different VAS. For example, the process may need more memory than is available in the VAS. in other cases, the process may wish to access data that is contained in the VAS of a different process. Regardless of the reason, the process may wish to switch from the first VAS 160-1 to a second VAS 180-2. The techniques provided herein provide instructions executable by the processor to cause a process to switch from a first VAS 160-1 to a second VAS 160-2.
[0021] FIG. 2 depicts an example of switching a virtual address space according to the techniques described herein, in one example implementation, each process running on device 1 10 may include process state information 210. The process state information may include the contents of registers contained within the processor, in a multiprocessing system, multiple processes may run on the same processor. When a particular process is not actively running, processor state information, such as the processor register contents may be saved.
[0022] In addition, the process state information may include a program counter (PC) which may indicate the current instruction being executed within the process. Thus, when a context switch occurs, and a process that was not previously being executed begins execution, the PC may be used to tell the processor where to resume execution. 8
[0023] Another piece of process state may include a pointer to the page table root for the process (PT ROOT PTR). In many systems including a virtual memory system, page table structures are what is used to define a VAS. in order to better understand the techniques described herein, a review of one implementation of a virtual memory system may prove useful.
[0024] A system including a virtual memory system may include a VAS with a defined range. As mentioned above, the range may be from 0 to the maximum supported by the virtual memory system. As shown in FIG. 2, VAS 220 has an address range from 0- AX. It should be understood that the particular value of MAX is unimportant. The VAS may be broken down into smaller units called pages. For example, one common page size is 4 Kilobytes. Thus, a 4 Gigabyte VAS address space may be divided into slightly more than 1 million pages.
[0025] Each page of the VAS may be represented by a page table entry, and those combinations of the page table entries for the entire VAS may be referred to as a page table structure. FIG. 2 depicts a high level view of a page table structure 222-1 . The page table structure is depicted as containing a root node 223-1 , intermediate nodes 224-1 , and leaf nodes 225-1 . The leaf nodes may include the actual page table entries. It should be understood that the particular format of the page table structure is unimportant, but rather that the page table structure may have a root node from which all page table entries descend.
[0026] Each page table entry may include at least two pieces of information. The first piece of information may be if the page is currently mapped to physical memory. As mentioned above, a virtual memory system hides the fact that all of a process's VAS may not be contained in physical memory from the process. If the page is not in physical memory, the page may be stored in some other storage area (e.g. disk).
[0027] The second piece of information may be the address in physical memory storing the page (assuming the first piece of information indicates the page is stored in physical memory), it should be understood that because the physical memory may not necessarily be as large as the VAS, the virtual ί
address will likely not be equivalent to the physical address. Furthermore, because a multiprocessing system executes several processes, each process cannot simultaneously use the same physical memory, thus generally precluding virtual addresses from matching physical addresses.
[0028] In general, a process may wish to execute instructions or access data located at a specific virtual address. The virtual memory system may receive the virtual address and access the page table structure pointed to by the process state information (e.g. the PT ROOT PTR). The virtual memory system may traverse the structure to find the page table entry associated with the memory page containing the virtual address of interest. If the page is currently loaded into physical memory, the virtual memory system may return the address within the physical memory where the page is stored and the process may access the page in the physical memory. If the page is not currently in physical memory, a page fault occurs and control may be handed to the operating system. The operating system may then load the page from storage (e.g. disk) into the physical memory (this process may involve clearing space for the page in the physical memory be selecting a page to evict from physical memory and store to disk). Once the page has been loaded into physical memory, the process can access the address.
[0029] In the above explanation, it should be understood that the VAS may be defined by the page fable structure. In previous systems, the page table structure was strictly associated with a process. By making the page table structure a first class entity, the structure is no longer tied to a given process, and the corollary is true as well; the process is no longer tied to a given page table structure. Thus, in the current example, in order to associate a given process with a new VAS, the pointer to the page table root structure in the process state information 210 may be switched from the initial VAS to the new VAS.
[0030] It should be understood that additional steps may be executed in order to perform the switch. For example, the processor may include data associated with the first VAS in registers or in various levels of on processor caches. This data may need to be flushed to memory before switching from one VAS to another.
[0031] In operation, a process may wish to switch from a first VAS 220-1 to a second VAS 220-2. The process may first prepare for the switch by flushing processor registers and caches to the memory, as needed, to ensure that data associated with the first VAS is not inadvertently stored in the second VAS should a flush occur after the switch of the VAS. The processor may then update the page table root pointer of the process state information to point from the page table root 223-1 to page table root 223-2. As such, the VAS of the process then switches from VAS 220-1 to VAS 220-2. Because the each VAS is independent, the process has effectively increased the total size of its virtual address space. Furthermore, because the VAS spaces can exist independent of a process, the process gains access to the data stored in the VAS prior to the process switching to that VAS.
[0032] Although the previous example has been described in terms of switching the page table root pointer, it should be understood that this is not the only possible implementation. For example, in an alternative implementation, rather than switching to a new page table structure as identified by the page table root pointer, the contents of the page table structure (e.g. 222-1 ) may first be stored elsewhere (e.g. to disk, or in the address space of a different process, such as the operating system kernel). The contents of the page table structure 222-1 may then be overwritten with the contents of a different page table structure, thus effectively changing the page table structure 222-1 without changing the page table root pointer.
[0033] In other example implementations, page fables may not be used at ail. Such systems may use segment registers and offset computations to define virtual address spaces. However, it should be understood that the techniques for switching virtual address spaces are suitable for use regardless of the type of virtual memory system. What should be understood is that a VAS is treated as a first class entity and can be associated and / or disassociated with a process. [0034] It should be further understood that although virtual address spaces are independent entities, this does not mean that portions of the VAS cannot be shared or duplicated between virtual address spaces. For example, a VAS may contain several portions that are effectively defined by the process. For example, the BSS, data, and text portions of a process generally define the instructions and variables that are executed by the processor and are the functional code portions of the process, in addition, a portion of the VAS may be set aside for the kernel portion of the operating system (e.g. allowing the process to make system calls). Furthermore, and additional portion of the VAS may be set aside for the stack. The stack is a data structure used by the process to store temporary variables and return pointers, among other data. The VAS may also include portions such as the heap, from which the process may allocate new memory within the virtual address space. The VAS may also include memory mapped portions.
[0035] In some case, it may be desirable to switch from one VAS to a second VAS, yet still maintain the portions of the original VAS. For example, it may be desirable to maintain the kernel, stack, BSS, data, and text portions between the first and second VAS. In one example implementation, the portions of the VAS that are to be shared may simply be copied, in their entirety, from one VAS to the other.
[0036] In another example implementation, rather than duplicating the desired portions of the VAS, the references to the portions may be duplicated. For example, assume the page table entries denoted by the reference characters A, B, and C represent the kernel, stack, and BSS, data, and text page table entries. As shown in page table structure 222-1 , 222-2 those page table entries (A,B and C) can simply be duplicated in each page. Because the page table entries are associated with memory (either in physical memory or in storage), the second VAS 220-2 contains the same kernel, stack, and BSS, data, and text portions, without having to actually copy those portions.
[0037] It should be understood that the operating system or processor may provide an API or a new processor instruction to ensure the switch from the first VAS to the second VAS is safe. For example, the process may invoke a system call to inform the operating system to inform the operating system of the switch in VAS. The operating system may then alter process state information in order to accurately track the VAS that is currently active for the process, in another example implementation, the processor may provide a special instruction to execute the switch. The processor may be provided an identifier associated with the second VAS, and the processor would perform the switch in the page table roof pointer automatically, after state information is provided by the operating system.
[0038] FIG. 3 is an example of a high level flow diagram for switching virtual address spaces, according to techniques described herein. The example flow diagram of FIG. 3 may be implemented as instructions contained on a non- transitory medium, such as instructions 144. In block 310, a request may be received from a process to switch from a first virtual address space to a second virtual address space. As explained above, the switch may be requested because the process needs access to more memory than can be addressed in a single VAS, or it may be for other reasons, such as a desire to access data contained in a VAS that is different than the one currently associated with the process.
[0039] In block 320, the process state information may be modified to reflect the change from the first virtual address space to the second virtual address space. In some implementations, the switch may be implemented by changing the page table root pointer for the process from a page table associated with the first virtual address space to a page table associated with the second virtual address space. Other implementations are described in further detail below, with respect to FIG. 4.
[0040] FIG. 4 is another example of a high level flow diagram for switching virtual address spaces, according to techniques described herein. The example flow diagram of FIG. 4 may be implemented as instructions contained on a non-transitory medium, such as instructions 144. In block 405, a request to create the second virtual address space may be received. As mentioned above, a VAS is now a first class entity and may be created independently of a process. In block 410, the second virtual address space may be created. in some implementations, creating a VAS may include creating a new page table structure to associate with the new VAS. in other example implementations, creation of a new VAS may include creating the contents of a page table structure.
[0041] In block 415, access permissions for the first and second virtual address spaces may be defined. For example, read and write permissions for a virtual address may be defined and a given process's ability to access the VAS may depend on those permissions. For example, in one example
implementation, it may be desired that a VAS is only writeabie by one process at a time. As another example, a VAS may only be able to be deleted when no other process is using the VAS.
[0042] In block 420, a request may be received from a process to switch from a first virtual address space to a second virtual address space, in block 425, the defined access permissions for the first and second virtual address space may be enforced. For example, if a given VAS should not be accessed by a given process based on the permission defined in block 415, the request to switch the process into the prohibited VAS may be denied in order to enforce the permissions.
[0043] In block 430, at least a portion of the first virtual address space may be duplicated into the second virtual address space. As mentioned above, the duplication may be an actual copy of the address spaces from one space to another or it may be a copy of the page table entries associated with that portion of the address space. Regardless of implementation, the duplication of the address space may allow the process to continue executing without interruption.
[0044] Blocks 435-460 represent possible actions performed when switching from one virtual address space to another. Not all blocks need be executed by ail implementations and the depiction is intended to be an example. Other possible implementations may execute different blocks. What should be understood is that the process switches from a first VAS to a second VAS.
[0045] In block 435, the process state information may be modified to reflect the change from the first virtual address space to the second virtual address space. In one example imp!ementation, the process moves to block 440. In block 440, the contents of a page table Instance associated with the process may be stored to a data store. The contents may be associated with the first virtual address space, in block 445, the contents of the page table instance may be replaced with contents associated with the second virtual address space. A page table instance may be data structure corresponding to the page table structure described with respect to FIG. 2.
[0046] In a different example implementation, in block 450, the process may be disassociated from a first page table instance corresponding to the first virtual address space. In block 455, the process may be associated with a second page table instance corresponding to the second virtual address space.
[0047] In block 460, a processor instruction may be executed to switch from the first to the second virtual address spaces. In some implementations, the instruction may be a part of the processor instruction set. In other implementations, the instruction may result from the process making a system call. Regardless of implementation, the switch from one VAS to the other may include flushing processor caches and updating process state information.
[0048] In block 465, the second virtual address space may be maintained after the process has terminated. As mentioned above, a VAS is now a first class entity, meaning that it may exist separate from any process. Thus, a VAS may continue to exist even if it is no longer associated with a process.
[0049] In block 470, a request to delete the second VAS may be received. Again, because the VAS is a first class entity, it may be deleted just as any other first class entity may be deleted, in block 475, the second virtual address space may be deleted. For example, deletion may include deletion of the page table instance associated with the second VAS.
[0050] FIG. 5 is an example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein, in block 510, a process executing on a processor may identify a desire to switch from a first virtual address space to a second virtual address space. As mentioned above, the process may determine the desire to switch to a different VAS in order to access memory beyond that which is available in a single VAS or the process may wish to access data contained in a different VAS.
Regardiess of the reason for switching, the process may identify the desire to switch virtual address spaces.
[0051] In block 520 an identifier for the second virtual address space may be obtained. In order to switch to a different, an identifier associated with the second VAS may be used to particuiariy identify the address space to which the process will switch. In block 530, a process may request, from an operating system running on the processor, a switch from the first virtual address space to the second virtual address space. As mentioned above, the process need not be aware of the particular detail involved in switching from one address space to another. The process may simply identify the VAS to switch to (e.g. using the identifier) and then request the operating system to switch the process form the first VAS to the second VAS. The particular details of the switching process may be transparent to the process itself.
[0052] FIG. 6 is another example of a high level flow diagram of a process switching virtual address spaces according to techniques described herein, in block 805, creation of the second virtual address space may be requested. As explained above, a VAS is now treated as a first class entity, and as such, can be created independent of any process. Thus, the techniques described provide for the ability to request creation of a new VAS.
[0053] In block 610, an identifier associated with the created second virtual address space may be received. As mentioned above, a VAS may be identified through the identifier. The identifier may be created as part of the creation of a VAS. The identifier may then be sent to the process that requested creation of the second VAS, such that process is able to identify the created second VAS.
[0054] In block 615, a process executing on a processor, may identify a desire to switch from a first virtual address space to a second virtual address space. As mentioned above, the desire may stem from a desire to access memory beyond that which is accessible in a single VAS or it may stem from a desire to access data that is stored in a different VAS. [0055] In block 620, an identifier for the second VAS may be obtained. For example, the identifier may be the identifier that was received in block 810 in the case that the VAS has been newly created. The identifier may be associated with a VAS that was previously created. Regardless of when created the identifier may identify the VAS to which the process will switch.
[0056] In block 625, the process may request from an operating system running on the processor a switch from the first virtual address space to the second virtual address space.
[0057] In block 630, the process may request deletion of the second virtual address space. As mentioned above, the VAS is treated as a first class entity meaning that it can be created independently of a process. In addition, a VAS can be deleted independent of a process being destroyed. As such, when a VAS is no longer needed, deletion of the VAS may be requested, thus freeing up any resources being used to maintain the VAS to be deleted. As explained above, such resources may include page table structures or storage space used to store the data contained in page fable structures.

Claims

We Claim:
1 . A non-transitory processor readable medium containing thereon a set of instructions which when executed by a processor cause the processor to: receive a request from a process to switch from a first virtual address space to a second virtual address space; and
modify the process state information to reflect the change from the first virtual address space to the second virtual address space.
2. The medium of claim 1 , further comprising instructions to:
receive a request to create the second virtual address space; and create the second virtual address space.
3. The medium of claim 1 wherein the second virtual address space is created independent of the process.
4. The medium of claim 1 further comprising instructions to:
duplicate at least a portion of the first virtual address space into the second virtual address space.
5. The medium of claim 1 wherein switching from the first to the second virtual address spaces further includes instructions to:
execute a processor instruction to switch from the first to the second virtual address space.
6. The medium of claim 1 wherein modifying the process state information further comprising instructions to:
disassociate the process from a first page table instance corresponding to the first virtual address space; and
associate the process with a second page table instance corresponding to the second virtual address space.
7. The medium of claim 1 wherein modifying the process state information further comprising instructions to:
store the contents of a page table instance associated with the process to a data store, wherein the contents are associated with the first virtual address space; and
replace the contents of the page table instance with contents associated with the second virtual address space.
8. The medium of claim 2 further comprising instructions to:
maintain the second virtual address space after the process has terminated.
9. The medium of claim 2 further comprising instructions to:
receive a request to delete the second virtual address space; and delete the second virtual address space.
10. The medium of claim 1 further comprising instructions to:
define access permissions for the first and second virtual address spaces; and
enforce the defined access permissions for the first and second address space.
1 1. A method comprising:
identifying, by a process executing on a processor, a desire to switch from a first virtual address space to a second virtual address space;
obtaining an identifier for the second virtual address space; and requesting, from an operating system running on the processor, a switch from the first virtual address space to the second virtual address.
12. The method of claim 1 1 further comprising:
requesting creation of the second virtual address space; and receiving an identifier associated with created second virtual address space.
13. The method of claim 1 1 further comprising:
requesting, by the process, deletion of the second virtual address space.
14. A device comprising:
a processor to address physical memory;
an operating system running on the processor supporting a virtual memory system wherein a process is associated with a virtual address space; and
a memory storing instructions executable by the processor to allow a process running on the processor to switch from a first virtual address space to a second virtual address space.
15. The device of claim 14 further comprising:
the memory further storing instructions to allow the process to create and delete virtual address spaces.
PCT/US2015/049726 2015-09-11 2015-09-11 Switch process virtual address space WO2017044124A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/US2015/049726 WO2017044124A1 (en) 2015-09-11 2015-09-11 Switch process virtual address space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/US2015/049726 WO2017044124A1 (en) 2015-09-11 2015-09-11 Switch process virtual address space

Publications (1)

Publication Number Publication Date
WO2017044124A1 true WO2017044124A1 (en) 2017-03-16

Family

ID=58240912

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2015/049726 WO2017044124A1 (en) 2015-09-11 2015-09-11 Switch process virtual address space

Country Status (1)

Country Link
WO (1) WO2017044124A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10754792B2 (en) 2016-01-29 2020-08-25 Hewlett Packard Enterprise Development Lp Persistent virtual address spaces
US11086660B2 (en) 2016-03-09 2021-08-10 Hewlett Packard Enterprise Development Lp Server virtual address space

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050216695A1 (en) * 2004-03-26 2005-09-29 Jean-Pierre Bono Memory extension for a data processor to provide both common and separate physical memory areas for virtual memory spaces
US20050273570A1 (en) * 2004-06-03 2005-12-08 Desouter Marc A Virtual space manager for computer having a physical address extension feature
WO2011048606A2 (en) * 2009-09-25 2011-04-28 Kamlesh Gandhi Virtual-memory system with variable-sized pages
US20120066469A1 (en) * 2009-02-11 2012-03-15 Infinidat Ltd. Virtualized storage system and method of operating thereof
US20130232316A1 (en) * 2004-07-30 2013-09-05 Jason W. Brandt Maintaining processor resources during architectural evens

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050216695A1 (en) * 2004-03-26 2005-09-29 Jean-Pierre Bono Memory extension for a data processor to provide both common and separate physical memory areas for virtual memory spaces
US20050273570A1 (en) * 2004-06-03 2005-12-08 Desouter Marc A Virtual space manager for computer having a physical address extension feature
US20130232316A1 (en) * 2004-07-30 2013-09-05 Jason W. Brandt Maintaining processor resources during architectural evens
US20120066469A1 (en) * 2009-02-11 2012-03-15 Infinidat Ltd. Virtualized storage system and method of operating thereof
WO2011048606A2 (en) * 2009-09-25 2011-04-28 Kamlesh Gandhi Virtual-memory system with variable-sized pages

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10754792B2 (en) 2016-01-29 2020-08-25 Hewlett Packard Enterprise Development Lp Persistent virtual address spaces
US11086660B2 (en) 2016-03-09 2021-08-10 Hewlett Packard Enterprise Development Lp Server virtual address space

Similar Documents

Publication Publication Date Title
US9390028B2 (en) Coordination between memory-saving mechanisms in computers that run virtual machines
US10552337B2 (en) Memory management and device
US10592431B2 (en) Independent shared and process virtual address translations
US9430402B2 (en) System and method for providing stealth memory
JP5607943B2 (en) Memory system and wear level management method thereof
JP5071798B2 (en) Computer system, memory management method, and program thereof
EP2645259B1 (en) Method, device and system for caching data in multi-node system
KR20100132244A (en) Memory system and how to manage it
EP3281107A1 (en) Virtual machines backed by host virtual memory
EP2437462B1 (en) Data access processing method and device
US11347417B2 (en) Locking structures in flash memory
US10169088B2 (en) Lockless free memory ballooning for virtual machines
CN112241310A (en) Page table management, information acquisition method, processor, chip, device and medium
CN114201269B (en) Memory page changing method, system and storage medium
CN115617542A (en) Memory exchange method and device, computer equipment and storage medium
WO2017044124A1 (en) Switch process virtual address space
JP2024527054A (en) Dynamically allocatable physically addressed metadata storage - Patents.com
JP3485940B2 (en) Virtual storage control device and method
WO2019237862A1 (en) Layout method for linear address space, and computing device
US11086660B2 (en) Server virtual address space
CN116991762A (en) Method for updating page table attribute, processor and chip
JP7649317B2 (en) Disable memory accessor
KR101975058B1 (en) System and method for data availability support
US11150827B2 (en) Storage system and duplicate data management method
CN110874273A (en) Data processing method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15903751

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15903751

Country of ref document: EP

Kind code of ref document: A1