[GHC] #14330: Sparks are not started promptly

GHC ghc-devs at haskell.org
Wed Jun 6 03:15:36 UTC 2018


#14330: Sparks are not started promptly
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  sparks
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by winter):

 The current behavior is strange, from GHC Commentary/Rts/Scheduler:

 > So how does the spark turn into a thread? When the scheduler spots that
 the current capability has no runnable threads, it checks the spark pool,
 and if there is a valid spark (a spark that points to a THUNK), then the
 spark is turned into a real thread and placed on the run queue: see
 createSparkThread in rts/Sparks.c. Also, the scheduler attempts to share
 its available sparks with any other idle capabilities: see
 schedulePushWork in rts/Schedule.c.

 Why do we have to wait until there is no runnable threads? A new spark
 should at least have a same priority with a new thread created with
 `forkIO`. The right way to do this IMHO is to ''always''  check the sparks
 pool within one scheduling loop, this can be done by start a sparks thread
 dedicated to check sparks just like I/O or timer manager.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14330#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list