[GHC] #8231: Haskell's Run Time System doesn't save electricity

GHC ghc-devs at haskell.org
Thu Sep 5 07:49:45 CEST 2013


#8231: Haskell's Run Time System doesn't save electricity
------------------------------------------------+--------------------------
        Reporter:  UnixJunkie                   |            Owner:
            Type:  bug                          |           Status:  closed
        Priority:  normal                       |        Milestone:
       Component:  Runtime System               |          Version:  7.4.1
      Resolution:  invalid                      |         Keywords:  energy
Operating System:  Linux                        |  saving
 Type of failure:  None/Unknown                 |     Architecture:  x86_64
       Test Case:  provided in the description  |  (amd64)
        Blocking:                               |       Difficulty:
                                                |  Unknown
                                                |       Blocked By:
                                                |  Related Tickets:
------------------------------------------------+--------------------------
Changes (by thoughtpolice):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 This is because the parallel garbage collector is enabled by by default in
 the `-threaded` runtime, so even if your program is sequential the GC will
 use multiple cores. The fact your wallclock time doesn't go anywhere is
 thus not really surprising (it could even get worse, since threads may be
 crossing cache lines and cores in order to divide up the workload.)

 This is verifiable by running the application under `perf`:

 {{{
 $ sudo perf record -ag -- ./8231 +RTS -N4
 ...
 $ sudo perf report --stdio
 #
 # Samples: 194K of event 'cycles'
 # Event count (approx.): 142904701567
 #
 # Overhead  Command         Shared Object
 Symbol
 # ........  .......  ....................
 ........................................
 #
     47.97%     8231  8231                  [.] gcWorkerThread
                |
                --- gcWorkerThread
                    0x48fec0
                    0x1
 ...
 }}}

 so `gcWorkerThread` is dominating here.

 If you link with `-rtsopts` and run your program with `+RTS -N -qb -qg`,
 your problem will go away and you'll only see one core in use.

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




More information about the ghc-tickets mailing list