1.select {case}
"fmt"
"runtime"
"time"
)
func main() {
runtime.GOMAXPROCS(1)
go func() {
fmt.Println("a")
}()
go func() {
fmt.Println("b")
}()
go func() {
fmt.Println("c")
}()
fmt.Println("d")
select {
case _ = <-time.After(time.Second):
}
}
result:dabc
2.select {}
package main
import (
"fmt"
"runtime"
)
func main() {
runtime.GOMAXPROCS(1)
go func() {
fmt.Printf("a")
}()
go func() {
fmt.Printf("b")
}()
go func() {
fmt.Printf("c")
}()
fmt.Printf("d")
select {}
}
result:dcab
Because I set "runtime.GOMAXPROCS(1)", there's only one "Processor" in my program.
One "Processor" has only one "runq", and in/out operation is "FIFO"
My question is "why always... not rand...."