4 ms·
How are features like go routines and channels etc going to be supported? or they are not?
by fredliu 8y ago
How are features like go routines and channels etc going to be supported? or they are not?
- rqs 8y agoDig a little deeper: https://docs.google.com/document/d/131vjr4DH6JFnb-blm_uRdaC0_Nv3OUwjEY5qVCxCup4 https://docs.google.com/document/d/131vjr4DH6JFnb-blm_uRdaC0... Mentions: > Currently WebAssembly has no threads, but they are on the roadmap. Most Go code can run fine on a single thread. The only drawback is that “sysmon” is not available, thus there is no preemption of goroutines.
- shurcooL 8y ago"thread" here refers to logical thread. A single logical thread can be used to run any number of goroutines, just one at a time.
- candiodari 8y agoGo does both preemptive and cooperative multitasking, so there is no relation to the number of goroutines "running" and the number of threads (or for that matter, cpus or cores). https://en.wikipedia.org/wiki/Cooperative_multitasking https://en.wikipedia.org/wiki/Cooperative_multitasking How this works in Go ? Thoroughly simplified it happens because at every flow control statement in Go, including function calls, what really happens is that, first, Go asks it's runtime to switch goroutines, and only then goes into the if, or subroutine, or ...
- shurcooL 8y agoThey are supported. Similar to how they're supported on other architectures, by having a runtime with a scheduler.