Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BBT#565] Implement the BRAVO biased reader/writer lock #324

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Mar 3, 2022

  1. Implement the BRAVO biased reader/writer lock

    The goal of the BRAVO biased rwlock is to avoid readers taking the reader
    lock and thus contending for the atomic variable. Instead, readers raise a
    flag in an array to signal that they "took the lock" to any future writer.
    A writer takes the underlying atomic lock and waits for all readers to
    complete. While a writer has the lock, readers wait for the atomic rwlock.
    
    The hash table in PaRSEC is a prime example for a use-case: writers are
    extremely rare since the resizing happens rarely and the max size is capped.
    However, every thread locking a bucket also takes a reader-lock.
    We can thus avoid the contention on the global lock for most of the
    application run.
    
    The original proposal used a global hash table for all locks
    (https://arxiv.org/abs/1810.01553) but we use one array per lock.
    We know the number of threads in PaRSEC and can use fixed offsets, with
    padding to prevent cache line sharing (64B per thread). If an unknown
    thread takes the lock it goes straight to the atomic rwlock (unfortuntely,
    this includes the MPI progress thread at the moment).
    
    Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
    devreal committed Mar 3, 2022
    Configuration menu
    Copy the full SHA
    20a9f59 View commit details
    Browse the repository at this point in the history