PARALLEL DYNAMIC MEMORY ALLOCATION USING A LOCK-FREE POP-ONLY FIFO
First Claim
1. A method of allocating memory, the method comprising:
- receiving a first memory allocation request specifying a first amount of memory;
receiving a second memory allocation request simultaneously with the first memory allocation request, wherein the second memory allocation request specifies the first amount of memory;
identifying a first-in first-out buffer (FIFO) node size based on the first amount of memory;
selecting a first FIFO and a second FIFO that are each populated with FIFO nodes of the FIFO node size;
popping a first FIFO head node from the first FIFO to satisfy the first memory allocation request; and
popping a second FIFO head node from the second FIFO, simultaneously with the popping of the first FIFO head node, to satisfy the second memory allocation request.
1 Assignment
0 Petitions
Accused Products
Abstract
One embodiment of the present invention sets forth a technique for dynamically allocating memory using one or more lock-free pop-only FIFOs. One or more lock-free FIFOs are populated with FIFO nodes, where each FIFO node represents a memory allocation of a predetermined size. Each particular lock-free FIFO includes memory allocations of a single size. Different lock-free FIFOs may include memory allocations for different sizes to service allocation requests for different size memory allocations. A lock-free mechanism is used to pop FIFO nodes from the FIFO. The use of the lock-free FIFO allows multiple consumers to simultaneously attempt to pop the head FIFO node without first obtaining a lock to ensure exclusive access of the FIFO.
21 Citations
20 Claims
-
1. A method of allocating memory, the method comprising:
-
receiving a first memory allocation request specifying a first amount of memory; receiving a second memory allocation request simultaneously with the first memory allocation request, wherein the second memory allocation request specifies the first amount of memory; identifying a first-in first-out buffer (FIFO) node size based on the first amount of memory; selecting a first FIFO and a second FIFO that are each populated with FIFO nodes of the FIFO node size; popping a first FIFO head node from the first FIFO to satisfy the first memory allocation request; and popping a second FIFO head node from the second FIFO, simultaneously with the popping of the first FIFO head node, to satisfy the second memory allocation request. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A computing system, comprising:
-
a memory heap; a first first-in first-out buffer (FIFO) that is populated with a first quantity of FIFO nodes that each represent a portion of memory from the memory heap; a second FIFO that is populated with a second quantity of FIFO nodes that each represent the portion of memory from the memory heap; and a memory allocation engine that is configured to; receive a first memory allocation request specifying a first amount of memory; receive a second memory allocation request simultaneously with the first memory allocation request, wherein the second memory allocation request specifies the first amount of memory; identify a first-in first-out buffer (FIFO) node size based on the first amount of memory; select the first FIFO and the second FIFO based on the FIFO node size; pop a first FIFO head node from the first FIFO to satisfy the first memory allocation request; and pop a second FIFO head node from the second FIFO, simultaneously with the popping of the first FIFO head node, to satisfy the second memory allocation request.
-
-
12. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the processor to allocate memory, by performing the steps of:
-
receiving a first memory allocation request specifying a first amount of memory; receiving a second memory allocation request simultaneously with the first memory allocation request, wherein the second memory allocation request specifies the first amount of memory; identifying a first-in first-out buffer (FIFO) node size based on the first amount of memory; selecting a first FIFO and a second FIFO that are each populated with FIFO nodes of the FIFO node size; popping a first FIFO head node from the first FIFO to satisfy the first memory allocation request; and popping a second FIFO head node from the second FIFO, simultaneously with the popping of the first FIFO head node, to satisfy the second memory allocation request. - View Dependent Claims (13, 14, 15, 16, 17, 18, 19, 20)
-
Specification