Hi Dmitry,
Sorry, I am new to this group. I am contributor to Xen Scheduler and recently got exposed to golang and became interested in its scheduler. I was going through the go scheduler design doc and and found its design quite different from Xen's. https://docs.google.com/document/d/1d3iI2QWURgDIsSR6G2275vMeQ_X7w-qxM2Vp7iGwwuM/pub.
I have few doubts which I am posting below, please anyone of you can clarify on these.
"P’s (logical processors) are strictly partitioned between NUMA nodes. That is, if we want to start a P bound to NODE0, we need to get an M from NODE0 M pool. Each P has own local RunQ as now. Global RunQ and pool of idle G descriptors become partitioned between NUMA nodes."
---> Why there is need of runq per P. There can be Runq per groups of Ps in a node, or Ps per core ?
"ensure P <-> M affinity, lastm field is added to P. When Truntime wants to start a P it first tries to get p->lastm M to run it."
---> I hope here you mean that if P has to run then it will check the last M where it executed, if lastM is not idle it will look for other Ms. (but from where, does it pick any random M. Do we define any set of Ms where P can run or it can pick any P).
"What's left is scheduling policy. Current scheduling policy is very simple: new and unblocked goroutines go to local RunQ; network poller injects work into global queue; work stealing is completely random; GC reshuffles goroutines to balance work."
---> Do you mean work is picked form a global queue instead of independent Runqs. (Bit confused please, can you clarify).
I am looking at https://github.com/golang/go/blob/e97209515ad8c4042f5a3ef32068200366892fc2/src/runtime/proc.go for scheduler implementation.
Also, please can you let me know if the code is open for public contribution.
Thanks
Anshul Makkar
> "P’s (logical processors) are strictly partitioned between NUMA nodes. That
> is, if we want to start a P bound to NODE0, we need to get an M from NODE0 M
> pool. Each P has own local RunQ as now. Global RunQ and pool of idle G
> descriptors become partitioned between NUMA nodes."
>
>
> ---> Why there is need of runq per P. There can be Runq per groups of Ps in
> a node, or Ps per core ?
I don't think there is a need of a runq per P. As the doc says, that
is how it is currently implemented. The advantage of a runq per P is
that the P can switch between those goroutines without any locking.
I don't know what Dmitry was thinking regarding your other questions.
Ian
On Monday, September 25, 2017 at 11:32:18 PM UTC+2, anshul makkar wrote:
Hi Dmitry,
Sorry, I am new to this group. I am contributor to Xen Scheduler and recently got exposed to golang and became interested in its scheduler. I was going through the go scheduler design doc and and found its design quite different from Xen's. https://docs.google.com/document/d/1d3iI2QWURgDIsSR6G2275vMeQ_X7w-qxM2Vp7iGwwuM/pub.
I have few doubts which I am posting below, please anyone of you can clarify on these.
"P’s (logical processors) are strictly partitioned between NUMA nodes. That is, if we want to start a P bound to NODE0, we need to get an M from NODE0 M pool. Each P has own local RunQ as now. Global RunQ and pool of idle G descriptors become partitioned between NUMA nodes."
---> Why there is need of runq per P. There can be Runq per groups of Ps in a node, or Ps per core ?
"ensure P <-> M affinity, lastm field is added to P. When Truntime wants to start a P it first tries to get p->lastm M to run it."
---> I hope here you mean that if P has to run then it will check the last M where it executed, if lastM is not idle it will look for other Ms.
(but from where, does it pick any random M.
Do we define any set of Ms where P can run or it can pick any P).
"What's left is scheduling policy. Current scheduling policy is very simple: new and unblocked goroutines go to local RunQ; network poller injects work into global queue; work stealing is completely random; GC reshuffles goroutines to balance work."
---> Do you mean work is picked form a global queue instead of independent Runqs. (Bit confused please, can you clarify).
I am looking at https://github.com/golang/go/blob/e97209515ad8c4042f5a3ef32068200366892fc2/src/runtime/proc.go for scheduler implementation.
Also, please can you let me know if the code is open for public contribution.