I encountered a scenario recently where I had potential waits in a service that had heavy use of an RWMutex. caters for a relatively low number of write locks when under moderately heavy or persistent read lock use.I felt that this could become a bottleneck, and set out to attempt an implementation of an RWMutex that gave equal priority to write locks as read locks.This has resulted in Fair-Mutex. This is a heavier implementation than or , and it is slower, until there is a high demand for read and write locks when it can begin to outperform .This package includes an OpenTelemetry histogram for recording lock wait times for Lock() and RLock().Again, I want to stress that there is perhaps a fairly narrow use-case for Fair-Mutex, but I believe a valid one all the same.

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help