#2868: `par` `pseq` does not work as expected
------------------------------------+---------------------------------------
    Reporter:  hoangta              |        Owner:  simonmar        
        Type:  bug                  |       Status:  new             
    Priority:  normal               |    Milestone:  6.12 branch     
   Component:  Runtime System       |      Version:  6.10.1          
    Severity:  major                |   Resolution:                  
    Keywords:  par, pseq, parallel  |   Difficulty:  Easy (1 hr)     
    Testcase:                       |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple     |  
------------------------------------+---------------------------------------
Changes (by simonmar):

  * milestone:  6.10.2 => 6.12 branch

Comment:

 Copy of more detailed reply I sent to ghc-users:

 Your program is suffering from microbenchmarkitis, I'm afraid.  There's
 only one spark, which tickles a bug in the scheduler in 6.10.1 and earlier
 (but sometimes doesn't happen due to random scheduling behaviour).  Even
 with that fixed, the program uses fib which tickles another bug: when
 optimised, fib doesn't do any allocation, and GHC's scheduler relies on
 allocation happening at regular enough intervals.

 In 6.10.1 we never get to do load-balancing in this example, because fib
 doesn't ever yield control to the scheduler.  In HEAD, where we have work-
 stealing and don't rely on the scheduler for load-balancing, the load-
 balancing problem goes away but reveals another problem: the second thread
 wants to GC, but in order to GC it has to synchronise with the other
 running threads, but the other thread is running fib and never yields.  We
 can fix this by allowing CPUs to GC independently (which we plan to do),
 but even then you could still run into the same problem because eventually
 a global GC will be required.  If you really want to see the program
 running in parallel, turn off -O.

 ---------

 I've now fixed the scheduling bug in stable.

 {{{
 Wed Dec 10 14:42:35 GMT 2008  Simon Marlow <[EMAIL PROTECTED]>
   * Fix (part of) #2868: do load-balancing when there's only one spark
 }}}

 There's a similar bug in HEAD (but it happens less often), so I'm leaving
 the ticket open.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2868#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to