×

Read/write lock with reduced reader lock sampling overhead in absence of writer lock acquisition

  • US 7,934,062 B2
  • Filed: 06/22/2007
  • Issued: 04/26/2011
  • Est. Priority Date: 06/22/2007
  • Status: Active Grant
First Claim
Patent Images

1. A method for synchronizing access to shared data, comprising:

  • when reading said shared data is performed by a data reader;

    said data reader testing a writer flag that indicates whether a separate data writer is attempting to access said shared data;

    said data reader accessing said shared data using a fast read mechanism if said writer flag is not set, said fast read mechanism including said data reader performing an indicating action prior to reading said shared data that indicates to data writers desiring to access said shared data that said data reader has initiated accessing said shared data using said fast read mechanism; and

    said data reader accessing said shared data using a slow read mechanism if said writer flag is set, said slow read mechanism including said data reader waiting for a data writer to complete its access to said shared data; and

    when writing said shared data is performed by a data writer;

    said data writer setting said writer flag;

    following said writer flag setting, said data writer waiting for expiration of a grace period in which all executing instances of said data reader have an opportunity to either see said writer flag and initiate said slow read mechanism or complete said indicating action indicating that said data reader has initiated said fast read mechanism;

    following said grace period expiration, said data writer waiting until there are no data readers accessing said shared data using said fast read mechanism;

    following said waiting until there are no data readers, said data writer acquiring a lock on said shared data, said lock being different from said writer flag; and

    said data writer accessing said shared data.

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