On Mon, 7 Sep 2020 02:36:48 +0000 Suanming Mou <suanmi...@nvidia.com> wrote:
> Hi, > > Sorry for my late reply due to the vacation. > > > What is the performance impact of this for currently working applications > > that > > use a single thread to program flow rules. You are adding a couple of > > system > > calls to what was formerly a totally usermode operation. > Read the source for glibc and see what pthread_mutex does > If I understand correctly, in the non-contended single thread case, pthread > mutex lock should not go to the kernel space. > I also wrote a small application with pthread mutex, and strace shows no > system call was introduced. > > Another simple testing code below is to check the cycles cost difference in > every round between pthread mutex and spin_lock. > Micro benchmarks of locking is hard to see.