1
0
mirror of https://github.com/golang/go synced 2024-10-05 04:31:22 -06:00
go/src/pkg/runtime/freebsd
Dmitriy Vyukov ee24bfc058 runtime: unify mutex code across OSes
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
2011-11-02 16:42:01 +03:00
..
386 freebsd: Add stubs for runtime·osyield and runtime·usleep. 2011-09-30 16:39:10 -07:00
amd64 freebsd: Add stubs for runtime·osyield and runtime·usleep. 2011-09-30 16:39:10 -07:00
defs.c runtime: fix freebsd-amd64 (and part of 386) 2011-03-24 11:45:12 +11:00
mem.c runtime: faster finalizers 2011-10-06 18:42:51 +03:00
os.h runtime: turn "too many EPIPE" into real SIGPIPE 2011-04-25 16:58:00 -04:00
signals.h runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost 2010-11-04 14:00:19 -04:00
thread.c runtime: unify mutex code across OSes 2011-11-02 16:42:01 +03:00