A Simple Refine to WebKit's WTF::Lock

There is a very good article about lock in WebKit blog: Locking in WebKit. It has a lot details about the implementation and benchmarks.

TL; DR: The Lock is based on an user land implementation of Linux futex, with platform mutex and condition_variable.

After reading the article, I checked out the recent WebKit code, and tried the benchmark LockSpeedTest.cpp with some other locks, this is the result:

The weizi_mutex(the red line, i.e. the second line in the right end) is my toy mutex after reading the article, with one refinement:

In Unlock, in order for other threads to barge in as early as possible, it clears the holding bit first, and tries to awake another thread if the parking bit is set and hold_bit is still clear.

1 comment:

UNKNOWN said...

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Locksmith Quincy