How can I manually create threads in Go?

huangapple go评论71阅读模式
英文:

How can I manually create threads in Go?

问题

我知道goroutine是Go语言处理并发的方式,但是我正在进行一个测试,将比较常规的多线程服务器和使用水平触发的epoll的服务器与使用边缘触发的epoll的服务器。我知道如何创建epoll的服务器,但是我已经搜索了很多关于如何手动创建线程的资料,但是没有找到答案。

英文:

I'm aware that goroutines are the way to deal with concurrency in Go, however I'm running a test in which I will be comparing a regular multithreaded server vs a server using level triggered epoll vs edge triggered epoll. I can figure out how to create the epoll ones, however I've searched hi and low on how to create threads manually to no avail.

答案1

得分: 6

你不能这样做。在Go语言中,你无法控制这种类型的东西。

英文:

You cannot do that. In Go you cannot control this kind of stuff.

答案2

得分: 5

你可能可以将goroutine绑定到CPU线程:http://play.golang.org/p/mNPCyvpN2R(在多CPU/核心的机器上本地运行)。

英文:

You might be able to bind a goroutine to a CPU thread: http://play.golang.org/p/mNPCyvpN2R (run locally on a multi CPU/core machine).

huangapple
  • 本文由 发表于 2015年2月7日 01:00:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/28370903.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定