Methods and systems for deadlock-free allocation of memory
AssigneeInternational Business Machines Corporation
InventorsCarlos F. Fuente, William J. Scales
Life of this patent
Estimating the term…
Abstract
Methods and systems for memory management. A method for memory management includes: maintaining a reference count for at least one first process associated with a portion of memory; maintaining a shared reference count for at least one second process associated with the portion of memory; and freeing the portion of memory when the shared reference count is decremented to zero.
Claims19
A method for memory management, comprising:
- allocating to at least one first process a first page reference to a first page of memory;
- allocating to at least one second process a second page reference to a second page of memory;
- copying contents of the first page to the second page;
- merging sectors of the first page to the second page after the at least one second process has altered sectors of the second page;
- maintaining a first reference count for the at least one first process associated with the first page of memory;
- maintaining a first shared reference count for the at least one second process associated with the first page of memory, wherein the first shared reference count represents a number of non-updating processes accessing the first page;
- freeing the first page of memory when the first shared reference count is decremented to zero and the first reference count equals zero;
- incrementing the first shared reference count when a new non-updating process accesses the first page of memory;
- decrementing the first shared reference count when an existing non-updating process terminates;
- and
- maintaining a second reference count and a second shared reference count associated with the second page of memory, wherein the second shared reference count represents a number of non-updating processes accessing the second page of memory and is initially set to zero.
A system for allocating memory resources, comprising:
- a storage controller including hardware and software arranged to:
- designate I/O processes as one of updating processes and non-updating processes;
- allocate to the non-updating processes a first page reference to a first page of memory;
- allocate to the updating processes a second page reference to a second page of memory;
- copy contents of the first page to the second page;
- merge sectors of the first page to the second page after the updating processes have altered sectors of the second page;
- maintain a first reference count of the updating processes and a first shared reference count of the non-updating processes associated with the first page of memory;
- delay freeing the first page until the first shared reference count equals zero;
- increment the first shared reference count when a new non-updating process accesses the first page;
- decrement the first shared reference count when an existing non-updating process terminates;
- and
- maintain a second reference count and a second shared reference count associated with the second page, wherein the second shared reference count represents a number of non-updating processes accessing the second page and is initially set to zero.
A computer program product comprising a tangible computer-usable medium having a computer readable program embodied in the medium, wherein the computer readable program when executed on a storage controller causes the storage controller to:
- receive a first function call associated with a first process;
- designate the first process as a non-updating process;
- allocate to the first process a first page reference to a first page of memory;
- receive a second function call associated with a second process;
- designate the second process as an updating process;
- copy contents of the first page to a second page of memory;
- merge sectors of the first page to the second page after the second process has altered sectors of the second page;
- and
- delay freeing the first page until the first process terminates,
- wherein the delaying comprises:
- maintaining a first reference count and a first shared reference count associated with the first page, and
- freeing the first page when the first shared reference count equals zero,
- wherein the first shared reference count represents a number of non-updating processes accessing the first page, and
- wherein the computer readable program further causes the storage controller to:
- increment the first shared reference count when a new non-updating process accesses the first page,
- decrement the first shared reference count when an existing non-updating process terminates, and
- maintain a second reference count and a second shared reference count associated with the second page, wherein the second shared reference count represents a number of non-updating processes accessing the second page and is initially set to zero.
A method for managing memory, comprising:
- providing a direct memory access storage controller that operates to:
- designate I/O processes associated with a page of memory as one of updating and non-updating;
- allocate to the non-updating processes a first page reference to a first page of memory;
- allocate to the updating processes a second page reference to a second page of memory;
- copy contents of the first page to the second page;
- merge sectors of the first page to the second page after the updating processes have altered sectors of the second page;
- update a first reference count representing a number of updating processes associated with the first page;
- update a first shared reference count representing a total number of non-updating processes associated with the first page;
- free the page for use by other code when the first shared reference count decrements to zero;
- increment the first shared reference count when a new non-updating process accesses the first page;
- and
- decrement the first shared reference count when an existing non-updating process terminates;
- and
- maintain a second reference count and a second shared reference count associated with the second page, wherein the second shared reference count represents a number of non-updating processes accessing the second page and is initially set to zero,
- wherein the storage controller comprises a combination of hardware and software.
Dependencies are inferred from the claim text.