3 ms·
> Erlang is considered truly pre-emptive... Go is generally considered partially pre-emptive... Well, in Quasar we started taking the "fully preemptive" route,
by pron 12y ago
> Erlang is considered truly pre-emptive... Go is generally considered partially pre-emptive...
Well, in Quasar we started taking the "fully preemptive" route, but we saw that threads fall into two categories: those that block very often, and those that don't. Because the JVM, unlike Erlang and Go, gives you access to kernel threads, too, Quasar will simply warn you if you're using a fiber for a CPU-intensive operation that doesn't block often. Using reductions didn't work out so well because a "forcefully preempted" fiber still wants more CPU, which normally means it's doing something wrong.
- jeffdavis 12y agoGoing partially pre-emptive is a reliability hit though. One errant process/thread/fiber can bring the system to a halt (or at least one hardware thread). Erlang is designed for reliability, not CPU efficiency for CPU-intensive tasks.
- TheBenjaneer 12y agoGo actually does give you access to OS threads in the runtime package in the sense that you can easily reserve a thread for the current goroutine via http://golang.org/pkg/runtime/#LockOSThread http://golang.org/pkg/runtime/#LockOSThread and similarly can give it back up to the scheduler with runtime.UnlockOSThread()