Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
dc3b4932
Commit
dc3b4932
authored
Nov 15, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a paragraph about GOMAXPROCS
R=rsc CC=golang-dev
https://golang.org/cl/154153
parent
39f64bed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
effective_go.html
doc/effective_go.html
+16
-0
No files found.
doc/effective_go.html
View file @
dc3b4932
...
@@ -2233,6 +2233,22 @@ func (v Vector) DoAll(u Vector) {
...
@@ -2233,6 +2233,22 @@ func (v Vector) DoAll(u Vector) {
</
pre
>
</
pre
>
<p>
The current implementation of
<code>
gc
</code>
(
<code>
6g
</code>
, etc.)
will not parallelize this code by default.
It dedicates only a single core to user-level processing. An
arbitrary number of goroutines can be blocked in system calls, but
by default only one can be executing user-level code at any time.
It should be smarter and one day it will be smarter, but until it
is if you want CPU parallelism you must tell the run-time
how many goroutines you want executing code simultaneously. There
are two related ways to do this. Either run your job with environment
variable
<code>
GOMAXPROCS
</code>
set to the number of cores to use
(default 1); or import the
<code>
runtime
</code>
package and call
<code>
runtime.GOMAXPROCS(NCPU)
</code>
.
Again, this requirement is expected to be retired as the scheduling and run-time improve.
</p>
<h3
id=
"leaky_buffer"
>
A leaky buffer
</h3>
<h3
id=
"leaky_buffer"
>
A leaky buffer
</h3>
<p>
<p>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment