# Patent

## Title
Process retext for dynamically loaded modules

## Abstract

A computer implemented method, apparatus, and computer program product for dynamically loading a module into an application address space. In response to receiving a checkpoint signal by a plurality of threads associated with an application running in a software partition, the plurality of threads rendezvous to a point outside an application text associated with the application. Rendezvousing the plurality of threads suspends execution of application text by the plurality of threads. The application text is moved out of an application address space for the application to form an available application address space. The available application address space is an address space that was occupied by the application text. A software module is moved into the available application address space.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention is related generally to a data processing system and in particular to a method and apparatus for the migration of a software partition. More particularly, the present invention is directed to a computer implemented method, apparatus, and computer usable program code for inserting a checkpoint module into fully utilized application address space.
2. Description of the Related Art
In a software partitioned environment, a single instance of the operating system can be partitioned into multiple virtual operating system environments. Each of these virtual operating system environments is known as a software partition. A software partition is a virtualized operating system environment within a single instance of the operating system. An example of a software partition is AIX® workload partition (WPAR), which is a product available from International Business Machines (IBM®) Corporation.
Software running within each software partition will appear to have its own separate instance of the operating system. A software partition may include one or more processes. Processes in a software partition are completely isolated from processes in other software partitions in the same system. They are not allowed to interact with processes in other software partitions in the same system.
Data processing systems frequently utilize data integrity operations to ensure that the state of data stored in memory may be recreated in the event of a failure. A checkpoint operation is a data integrity operation in which the application state and memory contents for an application running on the kernel are written to stable storage at particular time points to provide a basis upon which to recreate the state of an application in the event of a failure. The particular time point at which state and memory contents are written to stable storage may be referred to as a checkpoint.
Checkpoint data may be used to migrate or restore a software partition, including any processes running in the partition, from one physical computing device to another physical computing device, while processes are still running in the software partition. Migration of a software partition involves checkpointing the state of every process in the partition on one data processing system and then restoring the state of every process on another data processing system using the checkpoint data.
User space technologies which perform checkpoint procedures to checkpoint application context and checkpoint data for a process may be inserted into the application process by an external checkpoint system. The insertion of a checkpoint module into an application address space may be performed unbeknownst to the application process. In addition, the checkpoint module may be inserted into the application process outside mainline application context via mechanisms such as signal handlers. A checkpoint module inserted in this manner is required to fit within the address space of the application. The insertion of a checkpoint module within an application poses a problem if the application address space is currently fully utilized before checkpoint module insertion or if the amount of space in the application address space is insufficient to accommodate the checkpoint module.
SUMMARY OF THE INVENTION
The illustrative embodiments provide a computer implemented method, apparatus, and computer usable program code for a retext process. In one embodiment, in response to receiving a checkpoint signal by a plurality of threads associated with an application running in a software partition, the plurality of threads rendezvous to a point outside an application text associated with the application. Rendezvousing the plurality of threads suspends execution of application text by the plurality of threads. The application text is moved out of an application address space which in turn allows the now vacated address space to be reused for a checkpoint module. The available application address space is an address space that was occupied by the application text. A software module is moved into the available application address space.



BRIEF DESCRIPTION OF THE DRAWINGS
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
FIG. 1 is a pictorial representation of a network of data processing systems in which illustrative embodiments may be implemented;
FIG. 2 is a block diagram of a data processing system in which illustrative embodiments may be implemented;
FIG. 3 is a block diagram illustrating the checkpoint process during the migration of a software partition in accordance with an illustrative embodiment;
FIG. 4 is a block diagram illustrating a data flow through a data processing system during a retext operation in accordance with an illustrative embodiment;
FIG. 5 is a flowchart illustrating a process for initiating a retext operation in accordance with an illustrative embodiment;
FIG. 6 is a flowchart illustrating a process for performing a retext operation in accordance with an illustrative embodiment; and
FIG. 7 is a flowchart illustrating a process for restoring application text to application address space after a checkpoint process is complete in accordance with an illustrative embodiment.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
With reference now to the figures and in particular with reference to FIGS. 1-2, exemplary diagrams of data processing environments are provided in which illustrative embodiments may be implemented. It should be appreciated that FIGS. 1-2 are only exemplary and are not intended to assert or imply any limitation with regard to the environments in which different embodiments may be implemented. Many modifications to the depicted environments may be made.
With reference now to the figures, FIG. 1 depicts a pictorial representation of a network of data processing systems in which illustrative embodiments may be implemented. Network data processing system 100 is a network of computers in which embodiments may be implemented. Network data processing system 100 contains network 102, which is the medium used to provide communications links between various devices and computers connected together within network data processing system 100. Network 102 may include connections, such as wire, wireless communication links, or fiber optic cables.
In the depicted example, server 104 and server 106 connect to network 102 along with storage unit 108. In this example, server 104 and server 108 support a software partitioned environment.
In addition, clients 110, 112, and 114 connect to network 102. These clients 110, 112, and 114 may be, for example, personal computers or network computers. In the depicted example, server 104 provides data, such as boot files, operating system images, and applications to clients 110, 112, and 114. Clients 110, 112, and 114 may also include software partitions. Clients 110, 112, and 114 are clients to server 104 in this example. Network data processing system 100 may include additional servers, clients, and other devices not shown.
In this example, server 104 supports a software partition having one or more applications running in the software partition. The term “running” refers to a processor actively executing the instructions of a process.
The software partition is being migrated to client 110. In one embodiment, prior to migration of the software partition, a checkpoint process initiates the gathering and saving of checkpoint data regarding the state of all applications running in the software partition that is being migrated. The checkpoint data is saved to state files on any type of storage device, such as storage unit 108.
However, in another embodiment, checkpoint data is not saved to state files on storage 108. Instead, a departure server, such as server 104, transmits the checkpoint data directly to an arrival server, such as server 104. An arrival server is the server onto which the migrating software partition is moved. In other words, during migration of a software partition, the software partition is migrated or moved from a departure server to an arrival server. In this case, the checkpoint data is never saved on storage unit 108 and/or is saved on storage unit 108 after or in conjunction with transmitting the checkpoint data to server 104.
In the depicted example, network data processing system 100 is the Internet with network 102 representing a worldwide collection of networks and gateways that use the Transmission Control Protocol/Internet Protocol (TCP/IP) suite of protocols to communicate with one another. At the heart of the Internet is a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, governmental, educational and other computer systems that route data and messages. Of course, network data processing system 100 also may be implemented as a number of different types of networks, such as for example, an intranet, a local area network (LAN), or a wide area network (WAN). FIG. 1 is intended as an example, and not as an architectural limitation for different embodiments.
With reference now to FIG. 2, a block diagram of a data processing system is shown in which illustrative embodiments may be implemented. Data processing system 200 is an example of a computer, such as server 104 or client 110 in FIG. 1, in which computer usable code or instructions implementing the processes may be located for the illustrative embodiments. Data processing system 200 supports a software partitioned environment that includes one or more software partitions.
In the depicted example, data processing system 200 employs a hub architecture including a north bridge and memory controller hub (MCH) 202 and a south bridge and input/output (I/O) controller hub (ICH) 204. Processing unit 206, main memory 208, and graphics processor 210 are coupled to north bridge and memory controller hub 202. Processing unit 206 may contain one or more processors and even may be implemented using one or more heterogeneous processor systems. Graphics processor 210 may be coupled to the MCH through an accelerated graphics port (AGP), for example.
In the depicted example, local area network (LAN) adapter 212 is coupled to south bridge and I/O controller hub 204 and audio adapter 216, keyboard and mouse adapter 220, modem 222, read only memory (ROM) 224, universal serial bus (USB) ports and other communications ports 232, and PCI/PCIe devices 234 are coupled to south bridge and I/O controller hub 204 through bus 238, and hard disk drive (HDD) 226 and CD-ROM drive 230 are coupled to south bridge and I/O controller hub 204 through bus 240. PCI/PCIe devices may include, for example, Ethernet adapters, add-in cards, and PC cards for notebook computers. PCI uses a card bus controller, while PCIe does not. ROM 224 may be, for example, a flash binary input/output system (BIOS). Hard disk drive 226 and CD-ROM drive 230 may use, for example, an integrated drive electronics (IDE) or serial advanced technology attachment (SATA) interface. A super I/O (SIO) device 236 may be coupled to south bridge and I/O controller hub 204.
An operating system runs on processing unit 206 and coordinates and provides control of various components within data processing system 200 in FIG. 2. The operating system may be a commercially available operating system such as Microsoft® Windows® XP (Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both). An object oriented programming system, such as the JavaTM programming system, may run in conjunction with the operating system and provides calls to the operating system from Java programs or applications executing on data processing system 200. Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
Instructions for the operating system, the object-oriented programming system, and applications or programs are located on storage devices, such as hard disk drive 226, and may be loaded into main memory 208 for execution by processing unit 206. The processes of the illustrative embodiments may be performed by processing unit 206 using computer implemented instructions, which may be located in a memory such as, for example, main memory 208, read only memory 224, or in one or more peripheral devices.
The hardware in FIGS. 1-2 may vary depending on the implementation. Other internal hardware or peripheral devices, such as flash memory, equivalent non-volatile memory, or optical disk drives and the like, may be used in addition to or in place of the hardware depicted in FIGS. 1-2. Also, the processes of the illustrative embodiments may be applied to a multiprocessor data processing system.
In some illustrative examples, data processing system 200 may be a personal digital assistant (PDA), which is generally configured with flash memory to provide non-volatile memory for storing operating system files and/or user-generated data. A bus system may be comprised of one or more buses, such as a system bus, an I/O bus and a PCI bus. Of course the bus system may be implemented using any type of communications fabric or architecture that provides for a transfer of data between different components or devices attached to the fabric or architecture. A communications unit may include one or more devices used to transmit and receive data, such as a modem or a network adapter. A memory may be, for example, main memory 208 or a cache such as found in north bridge and memory controller hub 202. A processing unit may include one or more processors or CPUs. The depicted examples in FIGS. 1-2 and above-described examples are not meant to imply architectural limitations. For example, data processing system 200 also may be a tablet computer, laptop computer, or telephone device in addition to taking the form of a PDA.
A software partition is a virtualized operating system environment within a single instance of the operating system. A single instance of the operating system can be partitioned into multiple virtual operating system environments. Each of these virtual operating system environments is known as a software partition. An example of a software partition is AIX® workload partition (WPAR), which is a product available from International Business Machines (IBM®) Corporation.
Software running within each software partition will appear to have its own separate instance of the operating system. A software partition may include one or more processes. Processes in one software partition are completely isolated from processes in other software partitions on the same data processing system. They are not allowed to interact with processes in other software partitions.
A software partition, including any processes running in the partition, may be migrated from one physical computing device to another physical computing device while still active. The processes and/or other content of a software partition may also be migrated into another software partition on the same physical computing device.
Migration of a software partition involves checkpointing the state of every process in the partition on a first data processing system and then restoring the state of every process on a second partition using the checkpoint data. As used herein, the second partition may be a different partition located on the first data processing system or a different partition located on a different data processing system than the first data processing system.
A checkpoint operation is a data integrity operation in which the application state and memory contents for an application are written to stable storage at a particular time to provide a basis upon which to recreate the state of an application and/or processes running in a software partition, such as when a software partition is migrated from one physical computing device to another physical computing device. The process by which the state and memory contents are written to stable storage may be referred to as a checkpoint.
When a software partition is migrated from a departure server to an arrival server, a checkpoint operation is performed to obtain and store information regarding applications and/or processes running in the software partition. The state data may be saved into a state file on a local data storage device or on a remote data storage device, such as, but not limited to, a local hard disk, a network disk, a flash memory, a tape drive, a nonvolatile random access memory (NVRAM), or any other type of data storage device. Checkpoint operations are performed at various pre-defined points in time to generate checkpoint data.
The checkpoint data is utilized to recreate/restore the state of all processes running in the departure software partition at the last checkpoint into a new arrival software partition. A departure software partition is a first software partition on a computing device that is being migrated to a different computing device and/or a different software partition on the same computing device. The arrival software partition is a different software partition than the departure software partition. The processes running in the departure software partition are restored or restarted on the arrival software partition.
Checkpoint modules that perform checkpoint procedures to checkpoint application context and checkpoint data for an application process may be inserted into the application by an external checkpoint system. A module is a self-contained software component for performing a function. A checkpoint module is a module including software for performing checkpoint procedures on an application process to generate and save checkpoint data.
A checkpoint module may be inserted into an application address space outside mainline application context via mechanisms such as signal handlers. A signal handler is a function that is called when a signal is received by a shell script. A shell script refers to software that provides access to services of an application or a kernel. In this case, the signal handler inserts the checkpoint module into application address space in response to receiving a signal.
A checkpoint module inserted in this manner is required to fit within the address space of the application. Address space refers to the range of discrete memory space addresses that identify a physical location in computer memory for storing data associated with an application. The data associated with the application includes, but is not limited to, the executable code for the application, any data in stack or heap memory, and any other data associated with the application.
However, using currently available methods, the insertion of a checkpoint module within an application may not be possible if the application address space is currently fully utilized before checkpoint module insertion. In addition, the insertion of a checkpoint module may be impossible if the amount of space in the application address space is insufficient to accommodate the checkpoint module.
The lack of memory space available in application address space can prevent a checkpoint module or any other dynamically loaded module from being inserted into an application process. The illustrative embodiments recognize that normal application text is not actually utilized during checkpoint processing performed by a checkpoint module. The normal application text is the executable code that performs the work or functions of the application. For example, if the application is a word processor, the application text is the executable code associated with performing word processing functions.
Instead, it is only the data that must remain addressable during a checkpoint that is utilized during the checkpoint procedure. For example, data associated with the application that is stored in the heap and the stacks are utilized during the checkpoint procedure. Thus, the illustrative embodiments perform an operation referred to as “retext” to move aside the current application process text area and load a module, such as, but not limited to, a checkpoint module text and data into the application address space that was previously occupied by the application text.
The illustrative embodiments provide a computer implemented method, apparatus, and computer program product for dynamically loading a module into an application address space. In one embodiment, in response to receiving a checkpoint signal by a plurality of threads associated with an application running in a software partition, the plurality of threads rendezvous to a point outside an application text associated with the application. The term rendezvous refers to the threads meeting at a common point. Rendezvousing the plurality of threads suspends execution of application text by the plurality of threads. The application text is moved out of an application address space for the application to form an available application address space. The available application address space is an address space that was occupied by the application text. A software module is moved into the available application address space.
FIG. 3 is a block diagram illustrating a checkpoint procedure during the migration of a software partition in accordance with an illustrative embodiment. Data processing system 300 may be implemented in any type of network data processing system, including, without limitation, data processing system 100 in FIG. 1.
Departure server 302 and arrival server 304 are computing devices that support a software partitioned environment. Departure server 302 is the server on which the software partition is located before migration. Arrival server 304 is the server on which the software partition is located after migration. When a software partition is migrated, it “departs” from departure server 302 and “arrives” on arrival server 304.
The software partition on departure server 302 may be referred to as a first software partition or a departure software partition. The software partition on arrival server 304 after migration of the software partition to arrival server 304 may be referred to as a second software partition or an arrival software partition. Departure server 302 and arrival server 304 may be implemented in any type of computing device supporting a software partitioned environment, such as, but not limited to, server 104 or client 110 in FIG. 1. For example, departure server 302 may be, but is not limited to, a Websphere server or an Apache web server.
Kernel 306 and kernel 308 are software processes for managing resources on data processing system 300, such as, without limitation, processor resources, input and output (I/O) resources, and memory resources on a computing device. In other words, kernel 306 is an abstraction layer between hardware and software on departure server 302 and kernel 308 is an abstraction layer between hardware and software on arrival server 304.
Departure server 302 includes one or more software partitions for partitioning the operating system image within kernel 306 into multiple virtual operating system instances. In this example, departure server 302 includes software partitions 310-314. Arrival server 304 includes software partition 316. However, a server, such as departure server 302, is not limited to three software partitions. In accordance with the illustrative embodiments, a computing device, such as departure server 302 or arrival server 304, may include two software partitions, four software partitions, or any other number of software partitions in accordance with the illustrative embodiments.
Each software partition may include one or more processes. A process is an executing instance of a computer program or application, a task, or an operation being performed on data. In other words, a process executes the instructions in a computer program. A process may include any type of application or process running in a software partition. In this example, software partition 312 includes processes 320-322 and software partition 314 includes processes 324-328.
Software partition 312 is being migrated from departure server 302 to arrival server 304. A checkpoint controller is associated with each process running on software partition 312. A checkpoint controller is a software component of a given process that gathers process state data, data regarding open files and open sockets bound to the process, the state of streams associated with the process, the state of in-flight files associated with the process, and any other information regarding the current state of a process in software partition 312. The checkpoint data may then be used to recreate or re-establish each process running in software partition 312 to the same state that existed at the time the checkpoint controller gathered the checkpoint data. The time a checkpoint controller gathers checkpoint data is referred to as a checkpoint time.
For example, checkpoint controller 321 associated with process 320 saves state data for process 320. Another checkpoint controller (not shown) associated with process 322 saves state data associated with process 322 to a state file. The state data for processes 320-322 form checkpoint data 330. Checkpoint data 330 is utilized to restore or restart processes 320-322 on arrival server 304 in the same state that processes 320-322 were in on departure server 302 at the time checkpoint data 330 was last saved.
Checkpoint data 330 is a set of state files on data storage device 332 for storing state data regarding processes running on a software partition. The state of each process in a software partition can be stored in one state file. In this example, if a software partition had ten processes running on the software partition, checkpoint data 330 would contain ten state files. Checkpoint data 330 stores checkpoint state data for processes 320-322 running in software partition 312 to state files on data storage device 332 to form checkpoint data 330. In this example, checkpoint data 330 stores state information for software partition 312. However, checkpoint data 330 may include state files for multiple software partitions, rather than only a single software partition.
Checkpoint data 330 is stored in data storage device 332. Data storage device 332 is any type of known or available device for storing data, including, without limitation, a hard disk, a compact disk (CD), a compact disk rewrite-able (CD-RW), a compact disk read-only memory, a non-volatile random access memory (NV-RAM), a flash memory, or any other type of data storage device. Data storage device 332 may be located locally to departure server 302, locally to arrival server 304, remotely to departure server 302, and/or remotely to arrival server 304.
In this example, data storage device 332 is located remotely to departure server 302. In other words, data storage device 332 is implemented using one or more network data storage devices that are accessible to departure server 302 and/or arrival server 304 via a network connection, such as network 102 in FIG. 1. For example, data storage device 332 may include one or more remote data storage devices, such as storage unit 108 in FIG. 1. A network connection may be enabled via a network device associated with departure server 302 and/or arrival server 304.
A network device (not shown) is any type of known or available network access software for allowing a computing device to access a network. The network device connects to a network connection. The network connection permits access to any type of network. For example, a network may include, but is not limited to, a local area network (LAN), a wide area network (WAN), the Internet, an intranet, an Ethernet, a wireless network, or any other type of network.
In another embodiment, data storage device 332 is located locally to departure server 302. Data stored in data storage device 332 is shared or made accessible to arrival server 304 using protocols, such as file transfer protocols (FTP), and/or any other protocols for accessing data in a remote data storage device.
In this example, data storage device 332 is a single data storage device. However, in accordance with the illustrative embodiments, data storage device 332 may include two or more data storage devices. For example, data storage device 332 may include, but is not limited to, any combination of a local hard disk, a local non-volatile random access memory, and/or a remote hard disk that is accessible to arrival server 304 over a network connection.
FIG. 4 is a block diagram illustrating a data flow through a data processing system during a retext operation in accordance with an illustrative embodiment. Computer 400 may be implemented using any type of computing device, such as a personal computer, laptop, personal digital assistant, or any other computing device depicted in FIGS. 1 and 2.
Mobility checkpoint restart (MCR) 402 is a software component for managing and/or controlling the migration of executing processes from a departure software partition to an arrival software partition, as described in FIG. 3. Mobility checkpoint restart 402 also manages or initiates a retext operation in this embodiment.
Application 404 is any type of application or process running on a software partition, such as software partition 312 in FIG. 3. For example, application 404 could be, without limitation, a video game, a word processing application, a telnet application, an email application, a web browser application, a spread sheet, or any other type of application running on the software partition. Application 404 includes application text 406. Application text 406 is executable code that performs the work or functions of application 404.
Processor 408 is a processor, such as, without limitation, processor unit 206 in FIG. 2. Processor 408 is any type of known or available processor for executing a process on computer 400, including but not limited to, a central processing unit (CPU) or a digital signal processor (DSP). In this example, processor 408 is executing code associated with application 404.
Threads 410 is a set of one or more threads executing processes or tasks associated with application 404. For example, threads 410 may include a single thread, two threads, or twenty threads. In this example, threads 410 may include any number of threads. A thread is a part of a program that can execute independently of other parts of the program. In a multiprocessor system, two or more threads can execute concurrently on multiple processors.
Checkpoint module 412 is a self-contained software component for performing checkpoint procedures on application 404 to generate and save checkpoint data, such as checkpoint data 330 in FIG. 3. Checkpoint module 412 includes, but is not limited to, checkpoint code for performing checkpoint operations on processes running on a software partition. Checkpoint module 412 is stored on data storage 414. Data storage 414 may be implemented on any type of data storage device, including, but not limited to, storage 108 in FIG. 1 and/or data storage device 332 in FIG. 3. Data storage 414 may be a local data storage device to computer 400 as shown in FIG. 4. However, data storage 414 may also be a data storage device that is remote to computer 400. Computer 400 accesses a remote data storage device via a network connection, such as network 102 in FIG. 1.
When mobility checkpoint restart 402 receives a request to checkpoint a software partition on a departure server, such as departure server 302 in FIG. 3 and/or migrate a software partition to a new software partition on an arrival server, such as arrival server 304 in FIG. 3, mobility checkpoint restart 402 identifies all processes running in the software partition that are to be checkpointed. In this example, the processes running in the software partition to be checkpointed include application 404.
Mobility checkpoint restart 402 looks up a module that is to be loaded or inserted into application 404 during the retext operation. Mobility checkpoint restart 402 identifies a load module function using a load module symbol during signal delivery setup. The load module function is retrieved from a library of predefined functions, such as, but not limited to, the C library of functions (libc.a) for AIX® systems. In another embodiment, the load module function may be a user defined function rather than a predefined library function.
In this example, the load module function identified is a function for loading checkpoint module 412 into application 404. However, a module having any type of program code may be loaded into application 404. For example, a module for performing garbage collection functions, data retrieval functions, state restoration, and/or restart functions may also be inserted into application 404 during a retext.
The signal delivery setup sets up checkpoint signal 416 to initiate the retext operation for checkpoint module 412. Mobility checkpoint restart 402 sends checkpoint signal 416 to a signal handler associated with application 404. Checkpoint signal 416 initiates a thread rendezvous and retext operation.
Checkpoint signal 416 is received by each thread in threads 410 associated with application 404. A signal handler is a function that is called when a signal is received by any application program. In this case, the signal handler intercepts checkpoint signal 416 and initiates a thread rendezvous in the signal hander setup code.
Each thread in threads 410 rendezvous outside application text 406. During the thread rendezvous, threads 410 meet at a certain point in the kernel code outside of the normal application processing. In other words, a thread rendezvous refers to suspending execution of threads 410 at a safe point where all references to application text are no longer actively referenced by any thread. The rendezvous acts as a barrier that enables threads 410 to no longer actively depend on application text that is about to be vacated. During the thread rendezvous, the threads are not executing application text 406.
The last thread to enter the signal handler setup code at the rendezvous is designated as the primary thread. The primary thread performs subsequent operations while all the other threads in threads 410 wait at the rendezvous point until the retext operation is complete.
The primary thread proceeds to an untext operation which moves aside the current executable text area, application text 406, and sets up a new, virgin memory area of the same size in the application address space. In other words, the primary thread moves application text 406 out of the application address space. In one example, this can be accomplished by changing the memory addresses for application text 406. The virgin memory area that was previously occupied by application text 406 forms an available application address space.
The primary thread then proceeds into the load module function identified by mobility checkpoint restart 402. The load module function loads a module into the available application address space. In this example, the module function is a load checkpoint module function for loading checkpoint module 412 into the application address space for application 404.
The primary thread completes the retext operation via an operating system service that mimics the runtime dynamic loading of modules. The dynamic loading operation utilizes the virgin retext area instead of finding and allocating an unused memory area. The virgin retext area is an unused area of the application address space that was previously occupied by application text 406.
The entry point of the new retext module is saved. The primary thread stores the entry point of the retext module into the function destination for checkpoint signal 416. All threads in the rendezvous are now allowed to proceed into the retext module entry point. Checkpoint module 412 function performs checkpoint operations within the normal address space of application 404.
On completion of the checkpoint operation, threads 410 again rendezvous outside of checkpoint module 412 and the primary thread proceeds to remove checkpoint module 412 from the application address space and retext the original application text 406 back into the application address space for application 404.
Turning now to FIG. 5, a flowchart illustrating a process for initiating a retext operation is shown in accordance with an illustrative embodiment. The process in FIG. 5 is implemented by a software process for managing checkpointing and retext operations, such as mobility checkpoint restart 402 in FIG. 4.
The process begins by receiving a request from a user to migrate a software partition (step 502). The mobility checkpoint restart identifies all processes running in the software partition (step 504). The mobility checkpoint restart sends a checkpoint signal (SIGCHKPNT) initiating a thread rendezvous and retext operation for processes running in the software partition (step 506). The mobility checkpoint restart makes a determination as to whether the checkpoint process is complete (step 508). If the checkpoint process is not complete, mobility checkpoint restart returns to step 508 and waits until the checkpoint process is complete. The checkpoint process is performed by a checkpoint module, such as checkpoint module 412 in FIG. 4. When the checkpoint process is complete at step 508, the process transmits checkpoint data gathered and saved by the checkpoint process to state files to the destination server (step 510) with the process terminating thereafter.
FIG. 6 is flowchart illustrating a process for performing a retext operation in accordance with an illustrative embodiment. The process in FIG. 6 is implemented by threads associated with an application running in a software partition, such as threads 410 in FIG. 4.
The process begins when threads associated with an application running on a software partition receive a checkpoint signal (step 602). Each thread in the threads rendezvous outside the application text (step 604). A determination is made as to whether a thread in the threads is a last thread to enter the rendezvous (step 606). If a thread is not the last thread, the thread remains at the rendezvous point until the retext operation is complete at step 612.
If a thread is the last thread, that thread is the primary thread and the thread moves the application text out of the application address space (step 608) and load a checkpoint module into the application address space (step 610) using an operating system service that mimics the runtime dynamic loading of modules. The dynamic loading operation utilizes the retext area that was previously occupied by the application text rather than finding and allocating an unused memory area for the checkpoint module.
The process makes a determination as to whether the retext operation is complete (step 612). If the retext operation is not complete, the process returns to step 612 until the retext operation is complete. The retext operation is complete when the application text has been moved out of the application address space and the checkpoint module has been successfully loaded into the application address space.
When the retext operation is complete, all the threads proceed into the retext module (step 614). In this example, the retext module is a checkpoint module. The threads then perform the checkpoint operations (step 616) with the process terminating thereafter.
Referring now to FIG. 7, a flowchart illustrating a process for restoring application text to application address space after a checkpoint process is complete is depicted in accordance with an illustrative embodiment. The process in FIG. 7 is implemented by threads, such as threads 410 in FIG. 4.
The process begins by making a determination as to whether the checkpoint procedure is complete (step 702). The checkpoint procedure is complete when checkpoint data for a process running in a software partition that is being checkpointed has been generated and saved by the checkpoint procedure. If the checkpoint procedure is not complete, the process returns to step 702 until the process is complete.
When the checkpoint process is complete, the threads rendezvous at a point outside the checkpoint module (step 704). A determination is made as to whether a thread is a last thread to enter the rendezvous (Step 706). The last thread to enter the rendezvous point is the primary thread. If a thread is not the last thread, the thread remains at the rendezvous until the retext is complete at step 712.
If a thread is the last thread at step 706, the thread is a primary thread and the thread uses operating system services to move the checkpoint module out of the application address space (step 708) and load the application text back into the application address space (step 710).
A determination is made as to whether the retext operation to restore the application text to the application address space is complete (step 712). If the retext is not complete, all the threads except the primary thread, continue to wait at the rendezvous point. When the retext is complete, all the threads, including the primary thread, proceed into the application text (step 714). The threads then execute the application code associated with the application text (step 716) with the process terminating thereafter.
The illustrative embodiments provide a computer implemented method, apparatus, and computer program product for dynamically loading a module into an application address space. In one embodiment, in response to receiving a checkpoint signal by a plurality of threads associated with an application running in a software partition, the plurality of threads rendezvous to a point outside an application text associated with the application. Rendezvousing the plurality of threads suspends execution of application text by the plurality of threads. The application text is moved out of an application address space for the application to form an available application address space. The available application address space is an address space that was occupied by the application text. A software module is moved into the available application address space.
Thus, the illustrative embodiments allow one process to introspect another to reduce memory usage by dynamically loaded modules and to enable dynamic loading of modules even when an application address space is fully utilized by an application and data associated with the application. Moreover, a module may be dynamically loaded even if an application address space has some available space but the amount of available space is insufficient to accommodate a particular module that is to be dynamically loaded into the address space.
The retexting process of the illustrative embodiments permits the user to move the application text that is not needed during a checkpoint operation and replace the application text with the checkpoint module. After the checkpoint procedure performed by the checkpoint module is complete, the retexting operation automatically and dynamically removes the checkpoint module and restores the original application text. The threads then resume executing the application text as if the retext process had not occurred. This increases the efficiency of the checkpoint process and decreases the need for expensive memory.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the steps may occur out of the order noted in the figures. For example, two steps shown in succession may, in fact, be executed substantially concurrently, or the steps may sometimes be executed in the reverse order, depending upon the functionality involved. In addition, the invention may be implemented with fewer steps than shown in the figures and/or with additional steps not shown in the figures.
The invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment containing both hardware and software elements. In a preferred embodiment, the invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, etc.
Furthermore, the invention can take the form of a computer program product accessible from a computer-usable or computer-readable medium providing program code for use by or in connection with a computer or any instruction execution system. For the purposes of this description, a computer-usable or computer readable medium can be any tangible apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
The medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk, millipede storage technology, Magneto-resistive random access memory (MRAM), or phase-change memory, also known as PCM, PRAM, Ovonic Unified Memory, and Chalcogenide RAM (C-RAM). Current examples of optical disks include compact disk—read only memory (CD-ROM), compact disk—read/write (CD-R/W) and DVD.
A data processing system suitable for storing and/or executing program code will include at least one processor coupled directly or indirectly to memory elements through a system bus. The memory elements can include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code in order to reduce the number of times code must be retrieved from bulk storage during execution.
Input/output or I/O devices (including but not limited to keyboards, displays, pointing devices, etc.) can be coupled to the system either directly or through intervening I/O controllers.
Network adapters may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters.
The description of the present invention has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiment was chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.

## Claims

1. A computer implemented method for dynamically loading a module into an application address space, the computer implemented method comprising:
responsive to receiving a checkpoint signal by a plurality of threads associated with an application running in a software partition, rendezvousing the plurality of threads to a point outside an application text associated with the application, wherein rendezvousing the plurality of threads suspends execution of the plurality of threads;
moving the application text out of an application address space for the application to form an available application address space, wherein the available application address space is an address space previously occupied by the application text; and
loading a software module into the available application address space.

2. The computer implemented method of claim 1 further comprising:
responsive to loading the software module into the available application address space, allowing the plurality of threads to proceed out of the rendezvous point and into the software module; and
executing, by the plurality of threads, program code associated with the software module.

3. The computer implemented method of claim 2 wherein the plurality of threads are allowed to proceed into the software module via a signal handler associated with the checkpoint signal.

4. The computer implemented method of claim 1 wherein the software module is a checkpoint module for performing checkpoint operations to generate and save state data associated with the application.

5. The computer implemented method of claim 1 further comprising:
responsive to a determination that the checkpoint operations are complete, rendezvousing the plurality of checkpoints to a point outside the checkpoint module;
moving the checkpoint module out of the application address space associated with the application to form the available application address space; and
loading the application text into the available application address space.

6. The computer implemented method of claim 1 further comprising:
responsive to receiving a request to checkpoint a software partition, sending the checkpoint signal to the plurality of threads by a mobility checkpoint restart component.

7. The computer implemented method of claim 1 further comprising:
identifying a load checkpoint module function in a library of functions, wherein the load checkpoint function loads the software module into the available application address space.

8. The computer implemented method of claim 1 further comprising:
designating a primary thread in the plurality of threads, wherein the primary thread is a last thread in the plurality of threads to enter the point outside the application text at rendezvous.

9. The computer implemented method of claim 1 further comprising:
performing, by a primary thread, an untext operation, wherein the untext operation moves the application text out of a current executable text area and sets up the available application address space.

10. The computer implemented method of claim 1 further comprising:
designating a primary thread, wherein all the threads in the plurality of threads that are not designated as the primary thread wait at the rendezvous point until the software module is loaded into the available application address space.

11. A non-transitory computer readable storage medium storing a computer program product for dynamically loading a module into an application address space, said computer program product comprising:
computer usable program code, stored on the computer readable medium, for rendezvousing a plurality of threads associated with an application running in a software partition to a point outside an application text associated with the application in response to receiving a checkpoint signal by the plurality of threads, wherein rendezvousing the plurality of threads suspends execution of the plurality of threads;
computer usable program code, stored on the computer readable medium, for moving the application text out of an application address space for the application to form an available application address space, wherein the available application address space is an address space previously occupied by the application text; and
computer usable program code, stored on the computer readable medium, for loading a software module into the available application address space.

12. The non-transitory computer readable medium of claim 11 further comprising:
computer usable program code, stored on the computer readable medium, for moving the plurality of threads out of the rendezvous point and into the software module in response to loading the software module into the available application address space; and
computer usable program code, stored on the computer readable medium, for executing, by the plurality of threads, program code associated with the software module.

13. The non-transitory computer readable medium of claim 11 wherein the software module is a checkpoint module for performing checkpoint operations to generate and save state data associated with the application.

14. The non-transitory computer readable medium of claim 11 further comprising:
computer usable program code, stored on the computer readable medium, for rendezvousing the plurality of checkpoints to a point outside the checkpoint module in response to a determination that the checkpoint operations are complete;
computer usable program code, stored on the computer readable medium, for moving the checkpoint module out of the application address space associated with the application to form the available application address space; and
computer usable program code, stored on the computer readable medium, for loading the application text into the available application address space.

15. The non-transitory computer readable medium of claim 11 further comprising:
computer usable program code, stored on the computer readable medium, for designating a primary thread, wherein all the threads in the plurality of threads that are not designated as the primary thread wait at the rendezvous point until the software module is loaded into the available application address space.

16. An apparatus comprising:
a bus system;
a communications system coupled to the bus system;
a memory connected to the bus system, wherein the memory includes computer usable program code; and
a processing unit coupled to the bus system, wherein the processing unit executes the computer usable program code to rendezvous a plurality of threads associated with an application running in a software partition to a point outside an application text associated with the application in response to receiving a checkpoint signal by the plurality of threads, wherein rendezvousing the plurality of threads suspends execution of the plurality of threads; move the application text out of an application address space for the application to form an available application address space, wherein the available application address space is an address space previously occupied by the application text; and load a software module into the available application address space.

17. The apparatus of claim 16 wherein the processor unit further executes the computer usable program code to move the plurality of threads out of the rendezvous point and into the software module in response to loading the software module into the available application address space; and execute, by the plurality of threads, program code associated with the software module.

18. The apparatus of claim 16 wherein the software module is a checkpoint module for performing checkpoint operations to generate and save state data associated with the application.

19. The apparatus of claim 16 wherein the processor unit further executes the computer usable program code to rendezvous the plurality of checkpoints to a point outside the checkpoint module in response to a determination that the checkpoint operations are complete; move the checkpoint module out of the application address space associated with the application to form the available application address space; and load the application text into the available application address space.

20. The apparatus of claim 16 wherein the processor unit further executes the computer usable program code to designate a primary thread, wherein all the threads in the plurality of threads that are not designated as the primary thread wait at the rendezvous point until the software module is loaded into the available application address space.