On Wed, Aug 31, 2016 at 7:54 PM, Lin Hao <g0hacke...@gmail.com> wrote:
>
> I mean, sched.midle is a single linked list, but its mode of operation is
> different from sched.runqhead/runqtail, why? (or, Why they used different
> structure?)

The midle list is a list of M's that aren't doing anything.  It
doesn't matter which of them we use when we need one.  They weren't
doing anything anyhow.  So we just add M's on the front of the list
and remove them from the front of the list.

The runqhead/runqtail list is a list of G's that are waiting to run.
The G's on the list have work to do.  If we added G's on the front and
removed them from the front, then the one at the end would not run for
a very long time.  So for runqhead/runqtail we add them at the end and
remove them from the front.  That way every G on the list gets a fair
chance to run.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to