pithy words about reducing mutex contention

This commit is contained in:
Damian Gryski 2018-04-04 23:38:16 -07:00
parent 6879c72607
commit 11e8ec5fb0

View File

@ -953,6 +953,12 @@ Techniques specific to the architecture running the code
* Lazy synchronization; it's expensive, so duplicating work may be cheaper
* things you can control: number of workers, batch size
You need a mutex to protect shared mutable state. If you have lots of mutex
contention, you need to either reduce the shared, or reduce the mutable. Two
ways to reduce the shared are 1) shard the locks or 2) process independently
and combine afterwards. To reduce mutable: well, make your data structure
read-only
## Assembly
* Stuff about writing assembly code for Go