Efficiency of the ticket blocking algorithm?

Is anyone familiar with the ticket blocking algorithm that replaces the main spinlock algorithm in the linux kernel? I hope to find an expert on this. I read from several online sources that the ticket blocking algorithm should be faster, since the naive algorithm overloads the processor bus with all threads trying to get a lock at the same time. Can anyone confirm / refute this for me?

I did some of my experiments. Ticket locking is indeed fair, but its performance is almost comparable to the pthread spin-locking algorithm. In fact, it's just a little slower.

As I see it, the unfair algorithm should be a little faster, since the thread that starts the lock at an early stage ends faster, which allows the scheduler to work less.

I would like more information about this. If this is not so fast, why is ticket blocking implemented in the kernel and why is it not used in user space? thank!

+3
source share
1 answer

- , - linux? . -, , , . - / ?

. , - pthread. , .

, - . - , MCS. - , .

, , , , , .

. , . , . . , - , - , , . "" .

. , ? !

, , . , , .

+2

All Articles