×

System and method for implementing reader-writer locks using hardware transactional memory

  • US 9,727,369 B2
  • Filed: 05/16/2016
  • Issued: 08/08/2017
  • Est. Priority Date: 03/05/2013
  • Status: Active Grant
First Claim
Patent Images

1. A method, comprising:

  • performing by a computer;

    receiving, by a compiler executing on a processor of the computer, a multithreaded application that comprises code comprising one or more requests to acquire a shared reader-writer lock, wherein the shared reader-writer lock comprises a tail pointer and an ordered list of zero or more nodes, wherein the shared reader-writer lock controls access to a critical section of code or a shared resource by concurrently executing threads of the application; and

    compiling the code by the compiler to produce executable code, compiling including modifying the code responsive to determining that the code includes at least one of;

    a conditional branch on a local variable within a transaction,accesses to multiple shared variables within a transaction,a transaction that accesses only a single variable,one or more conditional branches within a transaction, oran indication that multiple threads wish to acquire a reader-writer lock on a single shared variable,wherein after the code is compiled to produce the executable code, execution of the executable code when performed results in;

    a given thread of the application inserting a node in the ordered list of nodes, wherein each node in the ordered list of nodes is owned by a respective thread that holds the shared reader-writer lock or that desires access to the critical section of code or shared resource in a read-only mode or in a write mode, and wherein only one thread can hold the shared reader-writer lock in a write mode at a time;

    subsequent to said inserting, the given thread acquiring the shared reader-writer lock in a read-only mode or in a write mode; and

    subsequent to said acquiring, the given thread releasing the shared reader-writer lock, wherein said releasing comprises removing the inserted node from the ordered list of nodes;

    wherein at least one of said inserting or said releasing comprises updating a value of the tail pointer within a hardware transaction or modifying a field of at least one node in the ordered list of nodes within a hardware transaction.

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