×

System and Method for Implementing NUMA-Aware Reader-Writer Locks

  • US 20130290967A1
  • Filed: 04/27/2012
  • Published: 10/31/2013
  • Est. Priority Date: 04/27/2012
  • Status: Active Grant
First Claim
Patent Images

1. A method, comprising:

  • performing by a computer;

    beginning execution of a multithreaded application that comprises one or more requests to acquire a shared lock, wherein the shared lock controls write access to a critical section of code or a shared resource by concurrently executing threads of the application, wherein only one thread can hold the shared lock for writing at a time, and wherein each of the concurrently executing threads of the application executes on one of a plurality of processor cores in a cluster of processor cores that share a memory, and wherein the cluster of processor cores is one of a plurality of clusters of processor cores on which threads of the multithreaded application are executing;

    a reader thread of the application;

    determining that no thread holds the shared lock for writing; and

    in response to determining that no thread holds the shared lock for writing;

    accessing the critical section of code or shared resource in read-only mode;

    subsequent to the reader thread accessing the critical section of code or shared resource in read-only mode, a writer thread of the application acquiring the shared lock for writing;

    in response to acquiring the shared lock for writing, the writer thread;

    accessing the critical section of code or shared resource for writing; and

    subsequent to said accessing the critical section of code or shared resource for writing;

    determining whether any other threads of the application executing on a processor core in the cluster of processor cores that comprises the processor core on which the writer thread is executing are waiting to acquire the shared lock for writing; and

    in response to determining that at least one other thread of the application executing on a processor core in the cluster of processor cores that comprises the processor core on which the writer thread is executing is waiting to acquire the shared lock for writing, passing ownership of a cluster-specific lock for writing to another thread of the application executing on a processor core in the cluster of processor cores that comprises the processor core on which the writer thread is executing that is waiting to acquire the shared lock for writing without releasing the shared lock.

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