(19)
(11)EP 1 920 334 B1

(12)EUROPEAN PATENT SPECIFICATION

(45)Mention of the grant of the patent:
08.08.2018 Bulletin 2018/32

(21)Application number: 06719885.3

(22)Date of filing:  30.01.2006
(51)International Patent Classification (IPC): 
G06F 12/02(2006.01)
(86)International application number:
PCT/US2006/003238
(87)International publication number:
WO 2007/011422 (25.01.2007 Gazette  2007/04)

(54)

SYSTEM AND METHOD FOR DETERMINISTIC GARBAGE COLLECTION IN A VIRTUAL MACHINE ENVIRONMENT

SYSTEM UND VERFAHREN ZUR DETERMINISTISCHEN MÜLLABFUHR IN DER UMGEBUNG EINER VIRTUELLEN MASCHINE

SYSTEME ET METHODE POUR UNE COLLECTE DE DECHETS DETERMINISTE DANS UN ENVIRONNEMENT DE MACHINE VIRTUELLE


(84)Designated Contracting States:
AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IS IT LI LT LU LV MC NL PL PT RO SE SI SK TR

(30)Priority: 15.07.2005 US 182137

(43)Date of publication of application:
14.05.2008 Bulletin 2008/20

(73)Proprietor: Oracle International Corporation
Redwood Shores, CA 94065 (US)

(72)Inventors:
  • LINDHOLM, David
    S-12064 Stockholm (SE)
  • JOELSON, Mattias
    S-5-19138 Sollentuna (SE)
  • PEURA, Noora
    S-14637 Tullinge (SE)

(74)Representative: D Young & Co LLP 
120 Holborn
London EC1N 2DY
London EC1N 2DY (GB)


(56)References cited: : 
US-A- 5 873 104
US-B2- 6 839 725
US-A1- 2004 111 448
  
      
    Note: Within nine months from the publication of the mention of the grant of the European patent, any person may give notice to the European Patent Office of opposition to the European patent granted. Notice of opposition shall be filed in a written reasoned statement. It shall not be deemed to have been filed until the opposition fee has been paid. (Art. 99(1) European Patent Convention).


    Description

    Field of the Invention:



    [0001] The invention is generally related to virtual machine environments and other run-time environments, and particularly to a system and method for improving the garbage collection times of the virtual machine memory.

    Background:



    [0002] Virtual machines are abstract computers that allow for portability of software applications between different underlying computer architectures. Typically, the virtual machine (VM) is a complex software product that is implemented upon a particular computer hardware platform and/or operating system. The VM then provides a uniform layer of abstraction between the hardware platform and any compiled software applications that will run thereon. Virtual machines are essential for the portability of certain technologies, including Java. The Java Virtual Machine (JVM) allows compiled Java programs to be run on the JVM, independently of whatever hardware or operating system may be underneath. Examples of commercially available JVMs include the Sun Java Virtual Machine from Sun Microsystems, Inc., and the JRockit Virtual Machine from BEA Systems, Inc.

    [0003] Virtual machines for languages such as Java, C#, Perl and Lisp include garbage collection features as part of the VM itself. Garbage collection allows the VM to reclaim unused computer memory during runtime, and is an important feature for the VM, since it relieves the programmer from much of the burden in providing for and managing memory cleanup within the software application itself. The basic concept of garbage collection is to find all of the data that is currently reachable from the software application, and then discard all other data. To release the memory used for a software object, the programmer only has to erase any pointer pointing to that object. The garbage collection logic or routines (also referred to as the garbage collector) will later detect that the object is no longer reachable, and will reclaim the memory.

    [0004] Traditionally, in the Java environment, during garbage collection the garbage collector pauses the running JVM and performs the necessary work. This is referred to as the garbage collector pause time, or simply the pause time. The pause time can cause problems for the programmer since it is difficult when preparing application code to anticipate for random pauses. JVMs with unpredictable pause times cannot be used for applications with strict timing requirements, such as real-time systems for telecommunications, physical processes or warning systems. Applications with more relaxed requirements, such as interactive applications, can still seem to fail if they do not respond to the user within an expected time frame.

    [0005] Much work has been done to improve the pause times for garbage collectors. For example, the pause time can be shortened by running the garbage collecting threads in parallel on multiple processors during the pause. The garbage collecting process can also be designed to be a generational one, in which case it is divided into a young collection (YC) phase that is performed often, and an old collection (OC) phase that is performed more seldom. Also, parts of the garbage collection process can be performed concurrently with the running software application, with short pauses to accommodate for changes performed by the running application.

    [0006] As described above, the current techniques used for garbage collection are unsatisfactory in environments and software applications that require strict timing, such as telecommunications, warning systems, and other real-time systems. What is desirable is a garbage collection technique that can enable predictable and short pause times within a virtual machine.

    [0007] US 2004/111448 A1 relates to a garbage collector that collects a generation of a dynamically allocated heap in a computer's memory incrementally. A collection set within the generation is associated with each collection increment. The collector reclaims for reuse the memory space occupied by any collection-set object not reachable by a reference chain that extends from outside the collection set. The collector monitors the total amount of allocation that occurs within the generation between collection increments, and it bases the collection-set size on those allocation amounts.

    Summary of the Invention:



    [0008] Disclosed herein is a system and method for deterministic garbage collection in a virtual machine (VM), or other runtime environment, and particularly for use in a system that includes a Java Virtual Machine (JVM). As described above, current techniques used for garbage collection have unpredictable pause times, and are unsatisfactory in environments and software applications that require strict timing, such as telecommunications, warning systems, and other real-time systems. An embodiment of the present invention addresses this problem by providing a system and a method to garbage collect memory in such a way that the pause time, with a high degree of probability, lies below a target pause time. From a first aspect the present invention provides a system according to appended claim 1. A corresponding method and computer readable medium are also provided as defined in appended claims 9 and 11. In accordance with another embodiment, the JVM can partially compact the preselected compaction area to keep the compaction time within the limits for pause times. In accordance with another embodiment, the JVM can predict the time required for final marking and repeat precleaning until the predicted final marking time is within the limits for pause times. In accordance with another embodiment, the JVM can improve pause times by redirecting application worker threads to do garbage collector work when entering or leaving the memory subsystem. Embodiments may also be combined to increase the probability for even shorter pause times.

    Brief Description of the Figures:



    [0009] 

    Figure 1 shows a schematic of the data structures for dirty cards and gray bits in accordance with both a traditional non-generational concurrent garbage collector, and the present invention.

    Figure 2 shows a flowchart that illustrates the process used by a traditional non-generational concurrent garbage collector.

    Figure 3 shows a schematic of the data structures in accordance with an embodiment of the present invention, that tracks the compaction area within the heap in such a way that it is possible to abort the compaction half-way and to not move objects with many referrers.

    Figure 4 shows an illustration of a system in accordance with an embodiment of the present invention, that includes a deterministic garbage collector.

    Figure 5 shows a flowchart in accordance with an embodiment of the present invention that illustrates the process used by a non-generational concurrent garbage collector with shorter and more predictable pause times.

    Figure 6 shows a flowchart in accordance with an embodiment of the present invention that illustrates the decision process for how many times precleaning should be repeated.

    Figure 7 show a flowchart in accordance with an embodiment of the invention that illustrates the decision process used to keep the compaction time within the calculated time limit.


    Detailed Description:



    [0010] Disclosed herein is a system and method for deterministic garbage collection in a virtual machine (VM), or other runtime environment, and particularly for use in a system that includes a Java Virtual Machine (JVM). As described above, current techniques used for garbage collection have unpredictable pause times, and are unsatisfactory in environments and software applications that require strict timing, such as telecommunications, warning systems, and other real-time systems. An embodiment of the present invention addresses this problem by providing a system and a method to garbage collect memory in such a way that the pause time, with a high degree of probability, lies below a target pause time. In accordance with an embodiment, the invention provides a system for deterministic garbage collection in a virtual machine environment, comprising: a virtual machine for executing a software application; a memory space for use by the virtual machine in storing software objects and pointers as part of the software application; and a garbage collector that estimates, for an area of the memory space, the sum of the pause times for garbage collection of the software objects within the area, and controls the garbage collection process so that the sum of the pause times for garbage collection will be lower than a target pause time limit. In accordance with another embodiment, the JVM can partially compact the preselected compaction area to keep the compaction time within the limits for pause times. In accordance with another embodiment, the JVM can predict the time required for final marking and repeat precleaning until the predicted final marking time is within the limits for pause times. In accordance with another embodiment, the JVM can improve pause times by redirecting application worker threads to do garbage collector work when entering or leaving the memory subsystem. Embodiments may also be combined to increase the probability for even shorter pause times. Experimental results have shown that the technique disclosed herein creates predictable and short pause times with an increase in fragmentation and memory usage, including in some instances keeping the pause times within the target pause time 99.99% of the time when the Java-heap does not contain more than 30% live objects.

    [0011] Figure 1 shows a schematic of the data structures for dirty cards and gray bits in accordance with both a traditional non-generational concurrent garbage collector, and with embodiments of the present invention. As shown in Figure 1, the dirty card array 101 is a byte array wherein each byte represents a small region of memory, typically a few hundred bytes. When the byte is a "zero" 102, then the card representing the region is clean. When the byte is any other value this means that the card is dirty 103. During runtime, a region becomes dirty when a worker thread (a thread that performs the actual work required by the user's application) updates a Java-object pointer within the region. The gray bits array 104 represents every possible location for a Java-object. To limit the number of gray bits a Java-object is always aligned on an 8-byte boundary. When a bit is a "zero" 105, there is no live object at that position. When a bit is a "one" 106, there is a live object at that position. Different objects take up different amounts of memory. The exact extent of the object in memory is found by examining the type of the object.

    [0012] Figure 2 shows a flowchart that illustrates the process used by a traditional non-generational concurrent garbage collector. In particular, Figure 2 shows a flowchart that illustrates how the traditional non-generational concurrent garbage collector includes six steps or phases: an initial marking phase 201, concurrent marking phase 202, precleaning phase 203, final marking phase 204, compaction phase 205 and sweeping phase 206.

    [0013] In step 201, the system sets up the data structures needed to perform garbage collecting which includes:

    Selecting a compaction area in the heap. The compaction area should be small enough to enable fast processing, and large enough to keep down the fragmentation;

    Setting up a compaction pointer location set. The compaction pointer location set stores all the pointer locations on the heap which contain pointers that point to objects within the selected compaction area. The compaction pointer location set is later traversed and the pointers are updated to reflect movements of objects within the compacted area; and

    Clearing the dirty card array 101. The clearing of the dirty card array takes some time, for example approximately 3 ms on a system with 1 Gb of Java-heap and a 1GHz Intel Pentium processor. During the clearing, no worker threads are allowed to run. The gray bits have already been cleared at the end of the previous garbage collection.



    [0014] In step 202, during the concurrent marking phase, the system traces all pointers from the roots (thread stacks and global data) to objects, and continues recursively with all pointers within these objects. Each time a new object is found the corresponding gray bit in the gray bit array 104 is checked and set. If it was already set, then the object has already been scanned and the concurrent marking thread can ignore it, otherwise it will recursively follow the pointers within the object. Since concurrent marking happens while the worker threads are running it is possible for a worker thread to update a pointer within a Java object that has already been scanned by the concurrent marking process. To remedy this, each time a worker thread updates a pointer, the card for the region of memory where the pointer is located, is marked as dirty. During the concurrent marking phase, every pointer is checked if it points into the selected compaction area. If it does point into the selected compaction area, then the pointer location is stored in a pointer location set for later retrieval during compaction.

    [0015] In step 203, during the precleaning phase, the system restarts the concurrent marking process with only the pointers within the dirty cards as roots. During this process the worker threads can generate even more dirty cards, but more likely the number of dirty cards are reduced.

    [0016] In step 204, the final marking phase is performed after precleaning. During this phase the worker threads are now paused so that the final marking can be performed and the last dirty cards are cleaned without any new cards being dirtied. At this point, the garbage collector now knows where all of the live objects are located on the Java-heap. In some instances, a situation may arise that some objects are believed to be live but, in fact, are not. This may happen if, for example, a Java- object pointer is zeroed but the object pointed to was scanned and marked before the zeroing. Such objects will be collected during the next garbage collection.

    [0017] Sometimes there is a lot of free memory on the Java-heap but none can be used because the largest contiguous free block is smaller than the required allocation size. In step 205, a compaction phase is used to prevent fragmentation of the Java-heap in these instances. During the concurrent phase described above, all pointers to objects within the selected compaction area are stored. Therefore, since the pointer locations are already collected, it is possible to move the objects within the compaction area and to update all pointers to the moved objects without scanning the Java-heap again. The objects are moved inside the compaction area to eliminate free memory between the objects. The worker threads are stopped while this compaction is in progress.

    [0018] In step 206, during the sweep phase the free areas of memory are gathered and linked together in free lists. Typically, one half of the memory space is swept while the other is in use by worker threads. The gray bits are set to zeros concurrently during this phase as well.

    [0019] It will be noted that, as described above, when using a traditional non-generational concurrent garbage collector the initial marking step 201, the final marking step 203, and the compaction step 204 cannot be made concurrent. As a result, the time spent in these steps needs to be predictable and limited, if the system is to perform satisfactorily.

    Deterministic Garbage Collection



    [0020] An embodiment of the present invention provides a system and a method to garbage collect memory in a virtual machine environment in such a way that the pause times lie below a set target pause time, with a high degree of probability.

    [0021] Figure 3 shows a schematic of the data structures in accordance with an embodiment of the invention, that can be used to track the compaction area within the heap in such a way that it is possible to control the time available to garbage collection and/or compaction, and, when necessary, to efficiently abort the compaction half-way and to not move those objects with many referrers. As shown in Figure 3, the Java-heap 301 contains a selected compaction area 302. During the concurrent marking phase, those pointers 304, 305 who point to objects 303 within the selected compaction area 302 are detected. In an embodiment, the pointers thus detected (i.e. the referrers) are stored within a hash table, a list, or a similar data structure 306, with an index or key representing the address of the object (303), and the values representing the locations of the pointers to this object (304, 305). The system can then make use of this hash table structure in the following ways:

    If, during compaction, the time limit for pause time is reached, it is possible to efficiently abort the compaction half-way. As described above, when using a traditional original pointer location set it is necessary to scan the full pointer location set, even if the compaction was aborted, because it was not known which pointer locations needed updating. However, in accordance with an embodiment of the present invention, the garbage collector can quickly find the pointer locations only for those objects that were actually moved;

    In another usage, if the number of pointer locations that point to an object is above a threshold, then the object is not moved because it would take too long to update all the pointer locations that point to it.



    [0022] In accordance with an embodiment, during the compaction phase a list of the pointer locations is sorted on the address pointed to in increasing order. Since the compaction is then performed with objects on addresses in increasing order (i.e. the objects are moved down in memory), the corresponding pointer location is tracked by a single pointer which moves through the sorted list of pointer locations.

    [0023] Figure 4 shows an illustration of a system in accordance with an embodiment of the present invention, that includes a deterministic garbage collector which controls the garbage collection process. As shown in Figure 4, the system 401 may include a computer or physical server 402, that includes a hardware 403, operating system 404, and run-time environment or virtual machine 405. The virtual machine may be a Java Virtual Machine (JVM), examples of which include the Sun Microsystems Inc. Java Virtual Machine, and the JRockit product from BEA Systems, Inc. The JVM includes, or has access to, a memory space 406, which in a Java environment comprises the Java-heap. The Java-heap in turn contains the objects and pointers 407 for the application being executed. In accordance with an embodiment of the invention, a deterministic garbage collector 408 (or a deterministic garbage collection process), successively analyzes portions of the Java-heap referred to as the compaction area 409. In accordance with an embodiment, the system also calculates thread local variables 410 for each worker thread. The thread local variables count how many times pointers are updated by the worker thread. Current information about the compaction area is stored in a hash table 411, a list, or a similar data structure, for use by the garbage collector during the garbage collection process.

    [0024] Figure 5 shows a flowchart in accordance with an embodiment of the present invention that illustrates how the above techniques result in a non-generational concurrent garbage collector with shorter and more predictable pause times. In accordance with this embodiment, the sum of the pause times during the garbage collection must, within a set degree of probability, be lower than the target pause time limit. As shown in Figure 5, in step 501, during an initial marking phase, the system performs an initialization largely similar to step 201 described above. In accordance with an embodiment, the system also calculates a thread local variable for each worker thread. In step 502, the concurrent marking phase proceeds largely similarly to step 202 described above. In accordance with an embodiment, the system also scans all live objects from the object roots. Additionally, when a pointer is updated by a worker thread, the worker thread local variable that counts the number of updates, is increased by a value of one.

    [0025] In accordance with an embodiment of the present invention, the system can make use of several processors to perform the concurrent marking phase. Apart from dedicated concurrent marking threads, this implementation forces worker threads to do some concurrent marking. When a worker thread requests a new thread local area (TLA) on the Java-heap, the worker thread is forced to perform some concurrent marking before returning to normal work.

    [0026] In step 503, the precleaning phase proceeds largely similarly to step 203 described above. Additionally, in accordance with an embodiment, the worker thread counters are set to a value zero, incurring a brief pause for the worker threads.

    [0027] After the precleaning phase, the process includes an additional deterministic garbage collection step 513, which is also described in further detail below with respect to Figure 6. In accordance with an embodiment, during the deterministic garbage collection step, the system sets the compaction time to a fractional value of the target pause time, thereby ensuring that this phase of the garbage collection process always lies below the target pause time. The estimation of the final marking time is based on statistics. Depending on the estimated final marking time the decision is taken to repeat, or not repeat, the precleaning.

    [0028] In accordance with one embodiment, the worker thread counters are summed while the worker threads are running. This sum will be equal to or greater than the total number of dirty cards, since several updates can dirty a single card.

    [0029] As a result of the deterministic garbage collection, in step 504, the final marking phase is only attempted when there are few enough dirty cards that the final marking pause time plus the other pause times will lie below the target pause time limit.

    [0030] It is possible that, despite the above precautions, due to occasional variations in the Java-heap structure it is not possible to delay the final marking with another precleaning. This can happen if, for example, the JVM runs out of Java-heap space and the garbage collection needs to be completed for the JVM to continue running. If this happens, then the pause time would exceed the target pause time limit. However, the above process ensures that the pause time is more likely not to exceed the target pause time limit.

    [0031] In step 505, compaction is performed using the information stored in hash table or structure 306.

    [0032] In step 506, sweeping is then performed largely similarly to step 206 described above.

    Deterministic Garbage Collection Details



    [0033] Figure 6 shows in more detail the steps of a deterministic garbage collection process in accordance with an embodiment of the invention. In particular, Figure 6 shows the process by which the system determines how many times precleaning should be repeated. In accordance with one embodiment, the series of steps described in Figure 6 takes place while the worker threads are running.

    [0034] To consider a real-world example, given a target pause time of 30 ms, the system might allocate one third of the target pause time, 10 ms, to the compaction phase, step 601. The compaction phase is the most flexible phase of the garbage collection process since it is only needed for long term stability of the system. It is possible to temporarily shorten the time spent on compaction as long as enough time is spent on compaction over the longer perspective. Embodiments of the present invention take advantage of this flexibility by setting the compaction time to a fractional value of the target pause time, thereby ensuring that this part of the garbage collection process always lies below the target pause time. The remaining time is allocated for initial marking and final marking. The initial marking has already taken place and that time is subtracted. The remaining time (for example, approximately 17 ms), is available for the final marking, step 602.

    [0035] In step 603, the worker thread counters are summed while the worker threads are running. This sum will be equal to or greater than the total number of dirty cards since several updates can dirty a single card. Locking is not required, since the garbage collector is only interested in the approximate value of the sum.

    [0036] In step 604, an estimation of the final marking time is determined, based on statistics. Experiments have shown that, with a high degree of probability, cleaning any dirty card for a Java-heap takes a constant amount of time. For example, it takes approximately 1 µs on a system with 1 Gb of Java-heap and a 1GHz Intel Pentium processor and 30% of live data. Embodiments of the present invention make use of the sum of the worker thread counters to estimate how long a period of time the final marking will take, by multiplying the sum with the estimated cleaning time for a dirty card. If, in step 604, the estimated final marking time exceeds the time calculated in step 602, then the decision is taken in step 605 to repeat the precleaning. If the final marking will lie below the allocated final marking time 602, then the decision is taken to proceed with the final marking.

    [0037] Figure 7 shows in more detail a process for keeping the compaction time within the calculated time limit in accordance with an embodiment of the invention. As shown in Figure 7, in step 701, an object is selected for possible movement. If there are no more objects to be moved the compaction is completed (also step 707). In step 702, by using the hash table or structure 306 the system can determine how many referrers must be updated if the selected object is moved. In step 703, a check is made to see if the time it would take to update the referrers lies below the remaining time allocated for compaction. The object can then be moved, or else another object is selected. In step 704, the system either moves the object down within the selected compaction area or evacuates it out of the selected compaction area to the bottom of the Java-heap. If there are few objects found within the compaction area then the objects are evacuated to leave a completely empty area behind. Otherwise they are moved within the compaction area. In step 705, the referrers to the moved object are then updated, again using the structure 306. If, in step 706 the remaining time is checked and it allows for more objects to be moved, then the process returns to repeat step 701. Otherwise, in step 707, the compaction process is completed.

    [0038] The present invention may be conveniently implemented using a conventional general purpose or a specialized digital computer or microprocessor programmed according to the teachings of the present disclosure. Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.

    [0039] In some embodiments, the present invention includes a computer program product which is a storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. The storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.

    [0040] The foregoing description of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. Particularly, while the embodiments of the systems and methods described above are described in the context of a JRockit environment, it will be evident that the system and methods may be used with other types of application servers, virtual machines, and Java Virtual Machines. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence.


    Claims

    1. A system for deterministic garbage collection in a virtual machine environment, comprising:

    a virtual machine for executing a software application;

    a memory space for use by the virtual machine in storing software objects and pointers as part of the software application;

    a garbage collector that estimates, for an area of the memory space, the pause time for garbage collection of the software objects within the area, and controls the garbage collection process so that the pause time for garbage collection will be lower than a target pause time limit; and

    characterized in that the area of the memory space is a compaction area (302),

    wherein the garbage collector sets the available compaction time allowed for the compaction area to a fractional value of the target pause time limit, and wherein, during compaction,
    if the available compaction time allowed for compaction is reached, the compaction is aborted, or if the number of pointer locations that point to a software object is above a threshold value, then the software object is not moved as part of the compaction step.
     
    2. The system of claim 1 wherein during a marking step, any pointers (304,305) that point to software objects within the compaction area are determined, and the pointers thus determined are stored in a table (306), with a key representing the address of the software object pointed to, and the locations of the pointers to the software object.
     
    3. The system of claim 1 or 2, wherein the garbage collector estimates the pause time for garbage collection based on statistics, and wherein the garbage collector controls the garbage collection process so that the pause time for garbage collection will be lower than the target pause time limit, within a degree of statistical probability.
     
    4. The system of claim 3, wherein the statistical estimate of the pause time for garbage collection of the software objects in an area of the memory space is based on one of information encoded into the system prior to running the software application, or run-time information collected by the system while the software application is running.
     
    5. The system of claim 1 or 2, further comprising worker threads, and a thread local variable that includes a value indicating the number of times a pointer is updated by a worker thread, and wherein the thread local variable value is used by the garbage collector in estimating the pause time for garbage collection, and wherein the thread local variable is an indication of the number of dirty cards that must be processed by the garbage collector during the next garbage collection.
     
    6. The system of claim 1 or 2, wherein the garbage collector selectively repeats a precleaning step for the software objects, wherein during the precleaning step, the garbage collector calculates a thread local variable for each worker thread that indicates how many times pointers are updated by the worker thread, and wherein the pause time is based on a statical estimate of a final marking time, and wherein, depending on the estimate for the final marking time the decision is made by the garbage collector to repeat, or not repeat, the precleaning step.
     
    7. The system of any preceding claim, wherein the virtual machine is a Java Virtual Machine.
     
    8. A method for deterministic garbage collection in a virtual machine environment, comprising the steps of:

    providing a virtual machine fox executing a software application;

    providing a memory space for use by the virtual machine in storing software objects and pointers as part of the software application;

    using a garbage collector to control the garbage collection of the software objects within the memory space, wherein the garbage collector estimates, for an area of the memory space, the pause time for garbage collection of the software objects within the area, and controls the garbage collection process so that the pause time for garbage collection will be lower than a target pause time limit; and

    characterized in that the area of the memory space is a compaction area (302),

    wherein the garbage collector sets the available compaction time allowed for the compaction area to a fractional value of the target pause time limit, and wherein, during compaction,
    if the available compaction time allowed for compaction is reached, the compaction is aborted, or if the number of pointer locations that point to a software object is above a threshold value, then the software object is not moved as part of the compaction step.
     
    9. The method of claim 8 wherein during a marking step, any pointers (304,305) that point to software objects within the compaction area are determined, and the pointers thus determined are stored in a table (306), with a key representing the address of the software object pointed to, and the locations of the pointers to the software object.
     
    10. A computer readable medium including instructions stored thereon which when executed cause the computer to perform the steps of:

    providing a virtual machine for executing a software application;

    providing a memory space for use by the virtual machine in storing software objects and pointers as part of the software application;

    using a garbage collector to control the garbage collection of the software objects within the memory space, wherein the garbage collector estimates, for an area of the memory space, the pause time for garbage collection of the software objects within the area, and controls the garbage collection process so that the pause time for garbage collection will be lower than a target pause time limit; and

    characterized in that the area of the memory space is a compaction area (302),

    wherein the garbage collector sets the available compaction time allowed for the compaction area to a fractional value of the target pause time limit, and wherein, during compaction,
    if the available compaction time allowed for compaction is reached, the compaction is aborted, or if the number of pointer locations that point to a software object is above a threshold value, then the software object is not moved as part of the compaction step.
     
    11. The computer readable medium of claim 10 wherein during a marking step, and pointers (304,305) that point to software objects within the compaction area are determined, and the pointers thus determined are stored in a table (306), with a key representing the address of the software object pointed to, and the locations of the pointers to the software object.
     


    Ansprüche

    1. System für die deterministische Speicherbereinigung (Garbage Collection) in einer virtuellen Maschinenumgebung, umfassend:

    eine virtuelle Maschine zum Ausführen einer Softwareapplikation;

    einen Speicherraum zur Verwendung durch die virtuelle Maschine beim Speichern von Softwareobjekten und Zeigern als Teil der Softwareapplikation;

    einen Garbage Collector, der für einen Bereich des Speicherraums die Pausenzeit für die Speicherbereinigung der Softwareobjekte innerhalb des Bereichs schätzt und den Speicherbereinigungsprozess steuert, so dass die Pausenzeit für die Speicherbereinigung unter einer Zielpausenzeitgrenze liegen wird; und

    dadurch gekennzeichnet, dass der Bereich des Speicherraums ein Verdichtungsbereich (302) ist, wobei der Garbage Collector die für den Verdichtungsbereich zulässige verfügbare Verdichtungszeit auf einen Bruchwert der Zielpausenzeitgrenze einstellt und wobei während der Verdichtung, falls die für die Verdichtung zulässige verfügbare Verdichtungszeit erreicht ist, die Verdichtung abgebrochen wird, oder falls die Anzahl der Zeigerstellen, die auf ein Softwareobjekt weisen, über einem Schwellwert liegt, dann wird das Softwareobjekt nicht als Teil des Verdichtungsschritts bewegt.


     
    2. System nach Anspruch 1, wobei während eines Markierungsschritts etwaige Zeiger (304, 305), die zu Softwareobjekten innerhalb des Verdichtungsbereichs zeigen, bestimmt werden und die so bestimmten Zeiger in einer Tabelle (306) gespeichert werden, wobei ein Schlüssel die Adresse des Softwareobjekts, auf das gewiesen wird, und die Stellen der Zeiger zu dem Softwareobjekt darstellt.
     
    3. System nach Anspruch 1 oder 2, wobei der Garbage Collector die Pausenzeit für die Speicherbereinigung auf Basis von Statistiken schätzt und wobei der Garbage Collector den Speicherbereinigungsprozess steuert, so dass die Pausenzeit für die Speicherbereinigung innerhalb eines Grads an statistischer Probabilität unter der Zielpausenzeitgrenze liegt.
     
    4. System nach Anspruch 3, wobei der statistische Schätzwert der Pausenzeit für die Speicherbereinigung der Softwareobjekte in einem Bereich des Speicherraums auf einer von Informationen basiert, die vor dem Durchführen der Softwareapplikation in das System codiert sind, oder Laufzeitinformationen, die durch das System gesammelt werden, während die Softwareapplikation läuft.
     
    5. System nach Anspruch 1 oder 2, weiterhin umfassend Worker Threads und einer Thread-Local-Variablen, die einen Wert enthält, der die Häufigkeit anzeigt, mit der ein Zeiger durch einen Worker Thread aktualisiert wird, und wobei der Wert der Thread-Local-Variablen durch den Garbage Collector beim Schätzen der Pausenzeit für die Speicherbereinigung verwendet wird und wobei die Thread-Local-Variable eine Anzeige der Anzahl von Dirty Cards ist, die durch den Garbage Collector während der nächsten Speicherbereinigung verarbeitet werden müssen.
     
    6. System nach Anspruch 1 oder 2, wobei der Garbage Collector selektiv einen Vorreinigungsschritt für die Softwareobjekte wiederholt, wobei während des Vorreinigungsschritts der Garbage Collector eine Thread-Local-Variable für jeden Worker Thread berechnet, die anzeigt, wie häufig Zeiger durch den Worker Thread aktualisiert werden, und wobei die Pausenzeit auf einem statistischen Schätzwert einer finalen Markierungszeit basiert und wobei in Abhängigkeit von dem Schätzwert für die finale Markierungszeit die Entscheidung durch den Garbage Collector getroffen wird, den Vorreinigungsschritt zu wiederholen oder nicht zu wiederholen.
     
    7. System nach einem vorhergehenden Anspruch, wobei die virtuelle Maschine eine Java Virtual Machine ist.
     
    8. Verfahren für die deterministische Speicherbereinigung in einer virtuellen Maschinenumgebung, umfassend die folgenden Schritte:

    Bereitstellen einer virtuellen Maschine zum Ausführen einer Softwareapplikation;

    Bereitstellen eines Speicherraums zur Verwendung durch die virtuelle Maschine beim Speichern von Softwareobjekten und Zeigern als Teil der Softwareapplikation;

    Verwenden eines Garbage Collector zum Steuern der Speicherbereinigung der Softwareobjekte innerhalb des Speicherraums, wobei der Garbage Collector für einen Bereich des Speicherraums die Pausenzeit für die Speicherbereinigung der Softwareobjekte innerhalb des Bereichs schätzt und den Speicherbereinigungsprozess steuert, so dass die Pausenzeit für die Speicherbereinigung unter einer Zielpausenzeitgrenze liegt; und

    dadurch gekennzeichnet, dass der Bereich des Speicherraums ein Verdichtungsbereich (302) ist, wobei der Garbage Collector die für den Verdichtungsbereich zulässige verfügbare Verdichtungszeit auf einen Bruchwert der Zielpausenzeitgrenze einstellt und wobei während der Verdichtung, falls die für die Verdichtung zulässige verfügbare Verdichtungszeit erreicht ist, die Verdichtung abgebrochen wird, oder falls die Anzahl der Zeigerstellen, die auf ein Softwareobjekt weisen, über einem Schwellwert liegt, dann wird das Softwareobjekt nicht als Teil des Verdichtungsschritts bewegt.


     
    9. Verfahren nach Anspruch 8, wobei während eines Markierungsschritts etwaige Zeiger (304, 305), die zu Softwareobjekten innerhalb des Verdichtungsbereichs zeigen, bestimmt werden und die so bestimmten Zeiger in einer Tabelle (306) gespeichert werden, wobei ein Schlüssel die Adresse des Softwareobjekts, auf das gewiesen wird, und die Stellen der Zeiger zu dem Softwareobjekt darstellt.
     
    10. Computerlesbares Medium mit darauf gespeicherten Anweisungen, die bei Ausführung bewirken, dass der Computer die folgenden Schritte durchführt:

    Bereitstellen einer virtuellen Maschine zum Ausführen einer Softwareapplikation;

    Bereitstellen eines Speicherraums zur Verwendung durch die virtuelle Maschine beim Speichern von Softwareobjekten und Zeigern als Teil der Softwareapplikation;

    Verwenden eines Garbage Collector zum Steuern der Speicherbereinigung der Softwareobjekte innerhalb des Speicherraums, wobei der Garbage Collector für einen Bereich des Speicherraums die Pausenzeit für die Speicherbereinigung der Softwareobjekte innerhalb des Bereichs schätzt und den Speicherbereinigungsprozess steuert, so dass die Pausenzeit für die Speicherbereinigung unter einer Zielpausenzeitgrenze liegt; und

    dadurch gekennzeichnet, dass der Bereich des Speicherraums ein Verdichtungsbereich (302) ist, wobei der Garbage Collector die für den Verdichtungsbereich zulässige verfügbare Verdichtungszeit auf einen Bruchwert der Zielpausenzeitgrenze einstellt und wobei während der Verdichtung, falls die für die Verdichtung zulässige verfügbare Verdichtungszeit erreicht ist, die Verdichtung abgebrochen wird, oder falls die Anzahl der Zeigerstellen, die auf ein Softwareobjekt weisen, über einem Schwellwert liegt, dann wird das Softwareobjekt nicht als Teil des Verdichtungsschritts bewegt.


     
    11. Computerlesbares Medium nach Anspruch 10, wobei während eines Markierungsschritts etwaige Zeiger (304, 305), die zu Softwareobjekten innerhalb des Verdichtungsbereichs zeigen, bestimmt werden und die so bestimmten Zeiger in einer Tabelle (306) gespeichert werden, wobei ein Schlüssel die Adresse des Softwareobjekts, auf das gewiesen wird, und die Stellen der Zeiger zu dem Softwareobjekt darstellt.
     


    Revendications

    1. Système de collecte de déchets déterministe dans un environnement de machine virtuelle, comprenant :

    une machine virtuelle pour l'exécution d'une application logicielle ;

    un espace de mémoire à utiliser par la machine virtuelle pour le stockage d'objets logiciels et de pointeurs faisant partie de l'application logicielle ;

    un collecteur de déchets qui estime, pour une région de l'espace mémoire, le temps de pause pour la collecte de déchets des objets logiciels dans la zone, et commande le processus de collecte de déchets de telle sorte que le temps de pause pour la collecte de déchets soit inférieur à une limite de temps de pause cible ; et

    caractérisé en ce que la zone de l'espace mémoire est une zone de compaction (302), dans lequel le collecteur de déchets définit le temps de compaction disponible autorisé pour la zone de compaction à une valeur fractionnelle de la limite de temps de pause cible, et dans lequel, lors de la compaction, si le temps de compaction disponible autorisé pour la compaction est atteint, la compaction est abandonnée ou, si le nombre d'emplacements de pointeurs qui pointent vers un objet logiciel est supérieur à une valeur seuil, alors l'objet logiciel n'est pas déplacé dans le cadre de l'étape de compaction.


     
    2. Système selon la revendication 1, dans lequel, pendant une étape de marquage, tous les pointeurs (304, 305) qui pointent vers des objets logiciels dans la zone de compaction sont déterminés, et les pointeurs ainsi déterminés sont stockés dans une table (306), avec une clé représentant l'adresse de l'objet logiciel pointé, et les emplacements des pointeurs de l'objet logiciel.
     
    3. Système selon la revendication 1 ou 2, dans lequel le collecteur de déchets estime le temps de pause pour la collecte de déchets en fonction de statistiques, et dans lequel le collecteur de déchets commande le processus de collecte de déchets de telle sorte que le temps de pause pour la collecte de déchets soit inférieur à la limite de temps de pause cible, dans les limites d'un degré de probabilité statistique.
     
    4. Système selon la revendication 3, dans lequel l'estimation statistique du temps de pause pour la collecte de déchets des objets logiciels dans une zone de l'espace mémoire est basée sur des informations codées dans le système avant l'exécution de l'application logicielle ou bien sur des informations de temps d'exécution collectées par le système tandis que l'application logicielle fonctionne.
     
    5. Système selon la revendication 1 ou 2, comprenant en outre des fils de travail ("worker threads") et une variable locale de fil qui inclut une valeur indiquant le nombre de fois qu'un pointeur est mis à jour par un fil de travail, et dans lequel la valeur de la variable locale de fil est utilisée par le collecteur de déchets pour l'estimation du temps de pause pour la collecte de déchets, et dans lequel la variable locale de fil est une indication du nombre de cartes sales qui doivent être traitées par le collecteur de déchets pendant la collecte de déchets suivante.
     
    6. Système selon la revendication 1 ou 2, dans lequel le collecteur de déchet répète sélectivement une étape de pré-nettoyage pour les objets logiciels, dans lequel, pendant l'étape de pré-nettoyage, le collecteur de déchets calcule une variable locale de fil pour chaque fil de travail qui indique combien de fois des pointeurs sont mis à jour par le fil de travail, et dans lequel le temps de pause est basé sur une estimation statistique d'un temps de marquage final, et dans lequel, en fonction de l'estimation du temps de marquage final, la décision est prise par le collecteur de déchets de répéter, ou ne pas répéter, l'étape de pré-nettoyage.
     
    7. Système selon l'une quelconque des revendications précédentes, dans lequel la machine virtuelle est une machine virtuelle Java.
     
    8. Procédé de collecte de déchets déterministe dans un environnement de machine virtuelle, comprenant les étapes consistant à :

    prévoir une machine virtuelle pour l'exécution d'une application logicielle ;

    prévoir un espace mémoire à utiliser par la machine virtuelle pour le stockage d'objets logiciels et de pointeurs faisant partie de l'application logicielle ;

    utiliser un collecteur de déchets pour commander la collecte de déchets des objets logiciels dans l'espace mémoire, lequel collecteur de déchets estime, pour une zone de l'espace mémoire, le temps de pause pour la collecte de déchets des objets logiciels dans la zone, et commande le processus de collecte de déchets de telle sorte que le temps de pause pour la collecte de déchets soit inférieur à une limite de temps de pause cible ; et

    caractérisé en ce que la zone de l'espace mémoire est une zone de compaction (302), dans lequel le collecteur de déchets définit le temps de compaction disponible autorisé pour la zone de compaction à une valeur fractionnelle de la limite de temps de pause cible, et dans lequel, lors de la compaction, si le temps de compaction disponible autorisé pour la compaction est atteint, la compaction est abandonnée ou, si le nombre d'emplacements de pointeurs qui pointent vers un objet logiciel est supérieur à une valeur seuil, alors l'objet logiciel n'est pas déplacé dans le cadre de l'étape de compaction.


     
    9. Procédé selon la revendication 8, dans lequel, pendant une étape de marquage, tous les pointeurs (304, 305) qui pointent vers des objets logiciels dans la zone de compaction sont déterminés, et les pointeurs ainsi déterminés sont stockés dans une table (306), avec une clé représentant l'adresse de l'objet logiciel pointé, et les emplacements des pointeurs de l'objet logiciel.
     
    10. Support lisible par ordinateur sur lequel sont stockées des instructions qui, lorsqu'elles sont exécutées, font en sorte que l'ordinateur exécute les étapes consistant à :

    prévoir une machine virtuelle pour l'exécution d'une application logicielle ;

    prévoir un espace mémoire à utiliser par la machine virtuelle pour le stockage d'objets logiciels et de pointeurs faisant partie de l'application logicielle ;

    utiliser un collecteur de déchets pour commander la collecte de déchets des objets logiciels dans l'espace mémoire, lequel collecteur de déchets estime, pour une zone de l'espace mémoire, le temps de pause pour la collecte de déchets des objets logiciels dans la zone, et commande le processus de collecte de déchets de telle sorte que le temps de pause pour la collecte de déchets soit inférieur à une limite de temps de pause cible ; et

    caractérisé en ce que la zone de l'espace mémoire est une zone de compaction (302), dans lequel le collecteur de déchets définit le temps de compaction disponible autorisé pour la zone de compaction à une valeur fractionnelle de la limite de temps de pause cible, et dans lequel, lors de la compaction, si le temps de compaction disponible autorisé pour la compaction est atteint, la compaction est abandonnée ou, si le nombre d'emplacements de pointeurs qui pointent vers un objet logiciel est supérieur à une valeur seuil, alors l'objet logiciel n'est pas déplacé dans le cadre de l'étape de compaction.


     
    11. Support lisible par ordinateur selon la revendication 10, dans lequel, pendant une étape de marquage, tous les pointeurs (304, 305) qui pointent vers des objets logiciels dans la zone de compaction sont déterminés, et les pointeurs ainsi déterminés sont stockés dans une table (306), avec une clé représentant l'adresse de l'objet logiciel pointé, et les emplacements des pointeurs de l'objet logiciel.
     




    Drawing


























    Cited references

    REFERENCES CITED IN THE DESCRIPTION



    This list of references cited by the applicant is for the reader's convenience only. It does not form part of the European patent document. Even though great care has been taken in compiling the references, errors or omissions cannot be excluded and the EPO disclaims all liability in this regard.

    Patent documents cited in the description