×

Lock free acquisition and release of a semaphore in a multi-core processor environment

  • US 9,342,379 B2
  • Filed: 01/21/2011
  • Issued: 05/17/2016
  • Est. Priority Date: 01/21/2011
  • Status: Active Grant
First Claim
Patent Images

1. A method, comprising:

  • acquiring a semaphore for a current thread from a data structure, wherein the data structure associates the semaphore with a generation number;

    concurrently with acquiring the semaphore, identifying the associated generation number as one of valid and invalid;

    concurrently with acquiring the semaphore, identifying a deletion flag as one of set and not set;

    decrementing a semaphore count of the semaphore upon acquisition of the semaphore when the associated generation number is identified as valid and the deletion flag is identified as not set, wherein the acquisition of the semaphore and a scheduling of the acquisition of the semaphore are both not controlled with a lock;

    initializing a scheduler stack upon storing a current thread context of the semaphore when the semaphore count is less than or equal to a first predetermined value;

    locking interrupts to prevent a new operation from preempting a pending operation on the semaphore upon initializing the scheduler stack;

    determining a release count of a pending queue associated with the semaphore, the release count is determined based on a predetermined threshold number of threads that can be added to the pending queue of the semaphore;

    generating a thread identification for the current thread when the release count is zero; and

    adding the thread identification to the pending queue as a representation of the current thread when the release count is less than a second predetermined value.

View all claims
  • 3 Assignments
Timeline View
Assignment View
    ×
    ×