Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"07-16-11 - Ticket FIFO Mutex"

2 Comments -

1 – 2 of 2
Anonymous Anonymous said...

Very nice, but... after fixing the std::memory_order constants to make it compile, it turns out that, ironically, the presumably much faster ticket mutex performs about the same as a simple W32 API critical section with a concurrency of 1 and 2, and is roughly 8 times *slower* with a concurrency of 4 (on a 4-core Intel).

February 1, 2012 at 4:40 AM

Blogger cbloom said...

"Okay, this is a very cheap lock in terms of the number of expensive atomics required, and it's FIFO (fair) which is nice in some cases, but it simply cannot be used outside of a kernel environment. The reason is that if the thread who is next in line get swapped out, then no currently running threads can get the lock, and we don't have any wakeup mechanism to get that sleeping thread to take the lock so we can make progress. This is okay in the kernel because the kernel is controlling which threads are awake or asleep, so obviously it won't put a thread to sleep that is currently spinning trying to get the lock. "

February 1, 2012 at 9:18 AM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.