Hello everyone, I'm new to here, I had a question about RTS Scheduler.
When I read through the GHC Wiki commentary on the scheduler I was
confused about this section:
"""
    One reason behind marking a Capability as free when it is handed
over is to support fast callouts.
When making a safe foreign call we have to release the Capability, and
therefore hand it over to
another worker thread. If the foreign call is short, we don't want to
incur the cost of a context switch
on returning, but since we marked the Capability as free there's a
good chance the returning Task
will be able to re-acquire it immediately and continue. The worker
that we woke up will find that the
Capability is owned, and go back to sleep again (this may incur a
double context switch if there are
no free CPUs on which to run the worker, however).
"""
My question is:
For the sentence in the parenthesis, what indeed will lead to the
"Double context switch", with or without marking a capability as free.
Furthermore, what are the two "switches" if they happen -- from who1
to who2, then who2 to who3?
Does "release the Cap" means there will be a re-schedule for
re-assigning the Cap, "make the Cap free" makes what different?
I had too much Questions on it since a was deeply confused:(

regards!

-- 
----------------
吴兴博
Wu Xingbo

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to