Method and system for memory allocation in a multiprocessing environment
First Claim
1. A method in a computer system for removing an item from a circular list that is simultaneously accessible by multiple threads of execution, each item pointing to a next item in the circular list, the method comprising:
- during execution of one thread, identifying an item to be removed from the circular list;
setting the item before the identified item to point to the item after the identified item; and
ensuring that the identified item points to an item of the circular list so that when another thread accesses the identified item after the identified item has been removed from the circular list, the identified item still points to a next item on the circular list.
4 Assignments
0 Petitions
Accused Products
Abstract
A method and system for allocating memory. The computer system on which the memory allocation system executes may support the simultaneous execution of multiple threads. Under control of a thread, the memory allocation system first identifies a bin associated with blocks (“lockers”) of memory large enough to satisfy a memory allocation request. When the identified bin has a free locker, the memory allocation system searches a circular list of headers associated with the identified bin for a collection of lockers (“warehouse”) that contains a locker that is available to be allocated. The memory allocation system allocates the found available locker to satisfy the request. If, however, the allocated bin has no free lockers, the memory allocation system allocates a warehouse with lockers large enough to satisfy the memory allocation request. The memory allocation system then adds a warehouse header for the allocated warehouse to a circular list of warehouse headers associated with the identified bin. The memory allocation system allocates a locker from the newly allocated warehouse to satisfy the memory allocation request.
-
Citations
68 Claims
-
1. A method in a computer system for removing an item from a circular list that is simultaneously accessible by multiple threads of execution, each item pointing to a next item in the circular list, the method comprising:
-
during execution of one thread, identifying an item to be removed from the circular list;
setting the item before the identified item to point to the item after the identified item; and
ensuring that the identified item points to an item of the circular list so that when another thread accesses the identified item after the identified item has been removed from the circular list, the identified item still points to a next item on the circular list. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
setting the item after the identified item to point to the item before the identified item.
-
-
3. The method of claim 2 wherein the circular list is only traversed in the direction of the next item.
-
4. The method of claim 1 including setting an indication in the identified item so that when the other thread access the identified item after the identified item has been removed from the circular list, the other thread will proceed to the next item pointed to by the identified item.
-
5. The method of claim 1 wherein the ensuring that the identified item points to an item of the circular list includes leaving the identified item to point to the item that was the next item before the identified item was removed from the circular list.
-
6. The method of claim 1 including preventing multiple threads from simultaneously adjusting the number of items in the circular list.
-
7. The method of claim 1 wherein when another item is removed from the circular list, the other item is set to point to the identified item so that when a thread accesses the other item after the other item has been removed from the circular list, the thread can locate an item still in the circular list through the identified item.
-
8. The method of claim 1 wherein the circular list and items removed from the circular list form a six list.
-
9. The method of claim 8 wherein the circular list form a circle portion of the six list and the items removed from the circular list from a tail portion of the circular list.
-
10. The method of claim 1 wherein the ensuring that the identified item points to an item of the circular list includes setting the identified item to point to another item previously removed from the circular list so that the identified item points to an item of the circular list indirectly through the previously removed item.
-
11. The method of claim 1 including:
setting a tail pointer to point to the identified item.
-
12. The method of claim 1 including:
-
identifying a second item to be removed from the circular list;
setting the item before the second identified item to point to the item after the second identified item; and
setting the second identified item to point to the identified item.
-
-
13. The method of claim 12 including:
setting a tail pointer to point to the second identified item.
-
14. The method of claim 1 wherein the items of the circular list and the items that have been removed form a six list and wherein a removed item is added back to the circular list, by
identifying a removed item; -
if the identified removed item does not already point to an item of the circular list, setting the identified removed item to point to an item of the circular list;
setting the item of the circular that is before the item to which the identified removed item points to point to the identified removed item.
-
-
15. The method of claim 14 including locking the six list before a removed item is added back to the circular list.
-
16. The method of claim 14 wherein the identified removed item is the only removed item that points to an item on the circular list.
-
17. The method of claim wherein items of the circular list are accessible through a circle pointer and items that have been removed are accessible through a tail pointer.
-
18. A method in a computer system for detecting unauthorized access of a first word of memory, the method comprising:
-
establishing forwarding for the first word of memory and setting the first word of memory to point to a second word of memory, the second word of memory being a valid memory location; and
establishing forwarding for the second word of memory and setting the second word of memory to point to an invalid memory location so that when the first word is accessed with forwarding enabled, the access is forwarded to the second word, which is in turn forwarded to the invalid memory location and unauthorized access to the first word is indicated; and
so that when the first word is accessed with forwarding disabled, the pointer to the second word of memory is retrieved and can be used to further access memory. - View Dependent Claims (19)
-
-
20. A computer-readable medium containing a data structure for use in allocating memory, the data structure containing:
-
a plurality of bins, each bin representing a size of memory that can be allocated from the bin;
for each bin, a circular list of warehouse headers; and
for each warehouse header, a warehouse that contains lockers of the size of memory that can be allocated for the bin. - View Dependent Claims (21, 22, 23, 24, 25, 26, 27, 28, 29)
-
-
30. A method in a computer system for allocating memory, the computer system supporting the simultaneous execution of multiple threads, the method comprising:
-
under control of a thread, identifying a bin associated with lockers of memory large enough to satisfy a memory allocation request;
when the identified bin has a free locker, searching a circular list of warehouse headers associated with the identified bin for a warehouse that contains a locker that is available to be allocated; and
allocating the found available locker to satisfy the request;
when the allocated bin has no free lockers allocating a warehouse with lockers large enough to satisfy the memory allocation request;
adding a warehouse header for the allocated warehouse to a circular list of warehouse headers associated with the identified bin; and
allocating a locker from the allocated warehouse to satisfy the memory allocation request. - View Dependent Claims (31, 32, 33, 34, 35, 36)
-
-
37. A computer-readable medium containing instructions for controlling a computer system to remove an item from a circular list that is simultaneously accessible by multiple threads of execution, each item pointing to a next item in the circular list, by a method comprising:
-
identifying an item to be removed from the circular list;
setting the item before the identified item to point to the item after the identified item; and
ensuring that the circular list is accessible through the identified item. - View Dependent Claims (38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51)
identifying a second item to be removed from the circular list;
setting the item before the second identified item to point to the item after the second identified item; and
setting the second identified item to point to the identified item.
-
-
49. The computer-readable medium of claim 48 including:
setting a tail pointer to point to the second identified item.
-
50. The computer-readable medium of claim 37 wherein the items of the circular list and the items that have been removed from a six list and wherein a removed item is added back to the circular list, by
identifying a removed item; -
if the identified removed item does not already point to an item of the circular list, setting the identified removed item to point to an item of the circular list; and
setting the item of the circular that is before the item to which the identified removed item points to point to the identified removed item.
-
-
51. The computer-readable medium of claim 50 including locking the six before a removed item is added back to the circular list.
-
52. A system in a computer system for removing an item from a circular list that is simultaneously accessible by multiple threads of execution, each item pointing to a next item in the circular list, including:
-
means for identifying an item to be removed from the circular list;
means for setting the item before the identified item to point to the item after the identified item; and
means for ensuring that the circular list is accessible through the identified item. - View Dependent Claims (53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68)
means for identifying a second item to be removed from the circular list;
means for setting the item before the second identified item to point to the item after the second identified item; and
means for setting the second identified item to point to the identified item.
-
-
64. The system of claim 63 including means for setting a tail pointer to point to the second identified item.
-
65. The system of claim 52 wherein the items of the circular list and the items that have been removed form a six list and wherein a removed item is added back to the circular list, by
identifying a removed item; -
if the identified removed item does not already point to an item of the circular list, setting the identified removed item to point to an item of the circular list; and
setting the item of the circular that is before the item to which the identified removed item points to point to the identifed removed item.
-
-
66. The system of claim 65 including means for locking the six list before a removed item is added back to the circular list.
-
67. The system of claim 65 wherein the identified removed item is the only removed item that points to an item on the circular list.
-
68. The system of claim 52 wherein items of the circular list are accessible through a circle pointer and items that have been removed are accessible through a tail pointer.
Specification