NUMA-Aware Reader-Writer Locks (PPoPP'13)
Description
The paper describes a new type of Reader-Writer Lock that is especially designed to perform well on Non-Uniform Memory Access (NUMA) systems. The authors compare variants of the new lock and other relevant locks. Link to paper: |
Questions
Question 1:
Fred described the queue based locks (MCS and CLH) during the introduction lecture. These locks can be considered to be fair because a thread that put itself in the queue before another thread will execute the critical section before that other thread. What performance advantage do you think locks that are not fair have on Non-Uniform Memory Access (NUMA) systems?
Question 2:
Let us say that we have a program running on a NUMA system with a total of 64 cores. The program has 64 threads. All the threads are accessing a hash table that is protected by a single Reader-Writer (RW) lock. The hash table is accessed for reading 80% of the times and for writing 20% of the times it is accessed. Why could the program benefit from using a RW lock with writer-preference compared to a RW lock with reader-preference or neutral-preference?
Fred
Q1: If the running thread is about to release the lock, it can be tempting to give it to another thread that is loaded on another core of the same chip, eventhough it is not the designated successor (not the first one of the queue) because the cache-to-cache communication will be cheaper. If the designated successor was loaded on a core of another chip, being not fair would save us the extra costly communication. Q2: The answer is in section 3.4 and especially in the section 4.3 (about the reader-preference performance pathology). |
Jonatan
Q1: Intra-node communication is more expensive. Unfortunate interleavings of lock-accesses from different NUMA-nodes could be avoided by letting all lock accesses originating from the same NUMA-node finish first. Q2: Assuming any thread may become a reader with 80% probability: Once a writer leaves the writer queue, it may turn into a reader with a high probability, blocking the increasingly long writer queue. |
Andreas
Q1: Q2: |
Pan
Q1: If the lock does not need to be fair, the lock can be handed over to a thread on the same NUMA node after one thread releases the lock. This can reduce the coherence traffic between NUMA nodes. Q2: When a writer finishes the operation, it is likely to turn into a reader again (since the probability of writes is 20% and the probability of reads is 80%) . In a RW-lock with read-preference, the writers need to wait for the readers to finish in order to proceed. This reader which is previously a writer will block all the other writers from proceeding. |
Martin
Q1: Q2: |
Afshin
Q1: Q2: |
Stavros
Q1: Q2: |
Yunyun
Q1: Q2: |
Pavol
Q1: Q2: |
Magnus
Q1: Q2: |
Sofia
Q1: Q2: |