×

Parallel dynamic memory allocation using a lock-free pop-only FIFO

  • US 9,417,881 B2
  • Filed: 01/30/2012
  • Issued: 08/16/2016
  • Est. Priority Date: 01/30/2012
  • Status: Active Grant
First Claim
Patent Images

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 included in a plurality of different FIFO node sizes based on the first amount of memory;

    selecting a first FIFO and a second FIFO based on the FIFO node size, wherein the first FIFO and the second FIFO are each populated with FIFO nodes of the FIFO node size, and at least one of the first FIFO and the second FIFO comprises a lock-free pop-only FIFO;

    determining that a first compare-and-swap (CAS) operation succeeded, wherein the first CAS operation swaps a first FIFO head value associated with the first FIFO with a next value of a FIFO node included in the first FIFO;

    in response to determining that the first CAS operation succeeded, popping a first FIFO head node associated with the first FIFO head value from the first FIFO to satisfy the first memory allocation request;

    determining that a second CAS operation succeeded, wherein the second CAS operation swaps a second FIFO head value associated with the second FIFO with a next value of a FIFO node included in the second FIFO; and

    in response to determining that the second CAS operation succeeded, popping a second FIFO head node associated with the second FIFO head value from the second FIFO, simultaneously with the popping of the first FIFO head node, to satisfy the second memory allocation request.

View all claims
  • 1 Assignment
Timeline View
Assignment View
    ×
    ×