• Dmitriy Vyukov's avatar
    runtime: unify mutex code across OSes · ee24bfc0
    Dmitriy Vyukov authored
    The change introduces 2 generic mutex implementations
    (futex- and semaphore-based). Each OS chooses a suitable mutex
    implementation and implements few callbacks (e.g. futex wait/wake).
    The CL reduces code duplication, extends some optimizations available
    only on Linux/Windows to other OSes and provides ground
    for futher optimizations. Chan finalizers are finally eliminated.
    
    (Linux/amd64, 8 HT cores)
    benchmark                      old      new
    BenchmarkChanContended         83.6     77.8 ns/op
    BenchmarkChanContended-2       341      328 ns/op
    BenchmarkChanContended-4       382      383 ns/op
    BenchmarkChanContended-8       390      374 ns/op
    BenchmarkChanContended-16      313      291 ns/op
    
    (Darwin/amd64, 2 cores)
    benchmark                      old      new
    BenchmarkChanContended         159      172 ns/op
    BenchmarkChanContended-2       6735     263 ns/op
    BenchmarkChanContended-4       10384    255 ns/op
    BenchmarkChanCreation          1174     407 ns/op
    BenchmarkChanCreation-2        4007     254 ns/op
    BenchmarkChanCreation-4        4029     246 ns/op
    
    R=rsc, jsing, hectorchu
    CC=golang-dev
    https://golang.org/cl/5140043
    ee24bfc0
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.ccmd Loading commit data...
Make.clib Loading commit data...
Make.cmd Loading commit data...
Make.common Loading commit data...
Make.inc Loading commit data...
Make.pkg Loading commit data...
all-qemu.bash Loading commit data...
all.bash Loading commit data...
clean.bash Loading commit data...
env.bash Loading commit data...
make.bash Loading commit data...
quietgcc.bash Loading commit data...
run.bash Loading commit data...
sudo.bash Loading commit data...
version.bash Loading commit data...