projekt pk_os_go

This commit is contained in:
aljazbrodar. 2026-01-10 09:19:35 +01:00
parent 5577560640
commit decc8f3324
16 changed files with 70 additions and 126 deletions

47
pk_os_go/g4.go Normal file
View file

@ -0,0 +1,47 @@
package main
import (
"fmt"
"os"
"runtime"
"runtime/trace"
"time"
debug "runtime/debug"
)
func child(c chan string) {
for msg := range c {
c <- msg
}
}
func main() {
f, err := os.Create("trace.out")
if err != nil {
panic(err)
}
defer f.Close()
if err := trace.Start(f); err != nil {
panic(err)
}
defer trace.Stop()
runtime.GOMAXPROCS(1)
debug.SetGCPercent(-1)
c := make(chan string)
go child(c)
const niters = 2000000
for i := 0; i < niters; i++ {
c <- "test"
reply := <-c
if len(reply) != 4 {
panic("err")
}
}
fmt.Println("done")
time.Sleep(1 * time.Second)
}

BIN
pk_os_go/pk_os_go.pptx Normal file

Binary file not shown.

BIN
pk_os_go/porocilo.pdf Normal file

Binary file not shown.