CL description first line should be runtime: add Semacquire/Semrelease benchmark http://codereview.appspot.com/4625065/diff/12001/src/pkg/runtime/sema_test.go File src/pkg/runtime/sema_test.go (right): http://codereview.appspot.com/4625065/diff/12001/src/pkg/runtime/sema_test.go#newcode49 ...
14 years, 2 months ago
(2011-06-27 16:19:36 UTC)
#4
http://codereview.appspot.com/4625065/diff/8002/src/pkg/runtime/sema_test.go File src/pkg/runtime/sema_test.go (right): http://codereview.appspot.com/4625065/diff/8002/src/pkg/runtime/sema_test.go#newcode77 src/pkg/runtime/sema_test.go:77: if block { I now have no idea what's ...
14 years, 2 months ago
(2011-06-27 17:53:19 UTC)
#7
14 years, 2 months ago
(2011-06-27 18:17:34 UTC)
#9
On 2011/06/27 17:53:19, rsc wrote:
> http://codereview.appspot.com/4625065/diff/8002/src/pkg/runtime/sema_test.go
> File src/pkg/runtime/sema_test.go (right):
>
>
http://codereview.appspot.com/4625065/diff/8002/src/pkg/runtime/sema_test.go#...
> src/pkg/runtime/sema_test.go:77: if block {
> I now have no idea what's going on here.
> Maybe it would be clearer with two different channels?
> Or a WaitGroup?
The logic itself it quite complicated. I've added some comments and split
"c<-<-c" to two separate statements.
Two channels most likely will deadlock, because there are corner cases (b.N=1)
where worker goroutines won't unblock all helper goroutines.
You have two different conditions here. Please use two different channels. http://codereview.appspot.com/4625065/diff/14002/src/pkg/runtime/sema_test.go File src/pkg/runtime/sema_test.go (right): ...
14 years, 2 months ago
(2011-06-27 18:20:32 UTC)
#11
On 2011/06/27 18:20:32, rsc wrote: > You have two different conditions here. > Please use ...
14 years, 2 months ago
(2011-06-27 18:42:12 UTC)
#13
On 2011/06/27 18:20:32, rsc wrote:
> You have two different conditions here.
> Please use two different channels.
I've added separate channel for helper goroutines and worked around the
deadlock.
I like this variant.
On 2011/06/27 18:44:04, rsc wrote: > Much nicer. > > Now the first if can ...
14 years, 2 months ago
(2011-06-27 18:52:46 UTC)
#15
On 2011/06/27 18:44:04, rsc wrote:
> Much nicer.
>
> Now the first if can be
>
> if block {
> sem = -procs/2
> }
It would be nice. But I afraid it won't work as expected.
LGTM http://codereview.appspot.com/4625065/diff/13002/src/pkg/runtime/sema_test.go File src/pkg/runtime/sema_test.go (right): http://codereview.appspot.com/4625065/diff/13002/src/pkg/runtime/sema_test.go#newcode8 src/pkg/runtime/sema_test.go:8: "sync/atomic" move down one line (sort)
14 years, 2 months ago
(2011-06-27 19:38:57 UTC)
#18
Issue 4625065: code review 4625065: runtime: add Semacquire/Semrelease benchmarks
(Closed)
Created 14 years, 2 months ago by dvyukov
Modified 14 years, 2 months ago
Reviewers:
Base URL:
Comments: 6