Memory management for garbage collection of critical real time threads
AssigneeInternational Business Machines Corporation
InventorAndrew Johnson
Life of this patent
Estimating the term…
Abstract
Mechanisms of memory management in a real time runtime environment having a garbage collected memory heap are provided. The runtime environment includes a critical real time thread that is precluded from accessing the garbage collected memory heap. The runtime environment further includes a scoped memory area for the allocation of objects therein for access by the critical real time thread. The mechanisms determine whether the critical real time thread is in a defined state in which a delay associated with garbage collection can be accommodated by the critical thread. The mechanisms further initiate, in response to a determination that the critical real time thread is in the defined state, a process of garbage collection of the scoped memory area.
Claims17
A method in a data processing system, of memory management in a real time runtime environment having a garbage collected memory heap, the runtime environment including a critical real time thread that is precluded from accessing the garbage collected memory heap, the runtime environment further including a scoped memory area for the allocation of objects therein for access by the critical real time thread, the method comprising:
- determining whether the critical real time thread currently accessing the scoped memory area is in a defined state so as to accommodate garbage collection of the scoped memory area;
- in response to a determination that the critical real time thread currently accessing the scoped memory area is in the defined state, initiating a process of garbage collection of the scoped memory area;
- identifying one or more software threads having references to objects allocated in the scoped memory area as root references;
- suspending the one or more software threads, in response to initiating the process of garbage collection of the scoped memory area, such that the execution of the one or more software threads is temporarily stopped;
- exiting the one or more software threads from a suspend state in response to identifying objects in the scoped memory area of the scoped memory system that are not marked;
- and
- compacting the scoped memory area by moving objects allocated in the scoped memory area to contiguous memory locations in the scoped memory area and updating references to moved objects to refer to the contiguous memory locations in the scoped memory area.
An apparatus for memory management in a real time runtime environment having a garbage collected memory heap, the runtime environment including a critical real time thread that is precluded from accessing the garbage collected memory heap, the runtime environment further including a scoped memory area for the allocation of objects therein for access by the critical real time thread, the apparatus comprising:
- a processor;
- and
- a memory coupled to the processor, wherein the memory comprises a computer program which configures the processor to:
- determine whether the critical real time thread currently accessing the scoped memory area is in a defined state so as to accommodate garbage collection of the scoped memory area;
- initiate, in response to a determination that the critical real time thread currently accessing the scoped memory area is in the defined state, a process of garbage collection of the scoped memory area;
- identify one or more software threads having references to objects allocated in the scoped memory area as root references;
- suspend the one or more software threads, in response to initiating the process of garbage collection of the scoped memory area, such that the execution of the one or more software threads is temporarily stopped;
- exit the one or more software threads from a suspend state in response to identifying objects in the scoped memory area of the scoped memory system that are not marked;
- and
- compact the scoped memory area by moving objects allocated in the scoped memory area to contiguous memory locations in the scoped memory area and updating references to moved objects to refer to the contiguous memory locations in the scoped memory area.
A computer program product in a computer readable medium, comprising computer program code which, when loaded into a computer system and executed thereon, causes the computer system to perform a memory management operation in a real time runtime environment having a garbage collected memory heap, the runtime environment including a critical real time thread that is precluded from accessing the garbage collected memory heap, the runtime environment further including a scoped memory area for the allocation of objects therein for access by the critical real time thread, the memory management operation comprising:
- determining whether the critical real time thread currently accessing the scoped memory area is in a defined state so as to accommodate garbage collection of the scoped memory area;
- in response to a determination that the critical real time thread currently accessing the scoped memory area is in the defined state, initiating a process of garbage collection of the scoped memory area;
- identify one or more software threads having references to objects allocated in the scoped memory area as root references;
- suspend the one or more software threads, in response to initiating the process of garbage collection of the scoped memory area, such that the execution of the one or more software threads is temporarily stopped;
- exit the one or more software threads from a suspend state in response to identifying objects in the scoped memory area of the scoped memory system that are not marked;
- and
- compact the scoped memory area by moving objects allocated in the scoped memory area to contiguous memory locations in the scoped memory area and updating references to moved objects to refer to the contiguous memory locations in the scoped memory area.
Dependencies are inferred from the claim text.