Is there anyway one kernel thread can switch between compute intensive tasks?

Alan Bateman Alan.Bateman at oracle.com
Thu Jan 25 14:30:17 UTC 2018


On 25/01/2018 09:51, kant kodali wrote:
> :
>
>
> If you actually run the program the count will only change for one job but
> not for all three jobs. But if I use green threads in Golang and assign
> each green thread an infinite loop they are able to switch however what I
> don't understand is that once a green thread assigns a kernel thread to run
> one infinite loop how come other green threads were able to schedule on the
> same kernel thread? can someone enlighten me here? Sorry if my question is
> naive.
Is your equivalent in Go using Printf in the loop? I don't know the Go 
runtime but that is one possible place for a kernel thread to yield. 
There is also the GOMAXPROCS variable to control the number of kernel 
threads that run concurrently.

-Alan.


More information about the loom-dev mailing list