Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1103701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:22:41+00:00 2026-05-17T01:22:41+00:00

The Haskell wiki shows that you need to both set a compilation flag and

  • 0

The Haskell wiki shows that you need to both set a compilation flag and a run-time flag to get multi-core support. Why isn’t using the library enough to get the correct behavior at compile time? Why can’t the run-time executable detect it was compiled with -threaded and use all cores on the system unless otherwise specified? I think turning these on by default would be better. Then there could be flags to turn off or modify these features.

http://www.haskell.org/haskellwiki/GHC/Concurrency#Multicore_GHC says:

  • Compile your program using the -threaded switch.
  • Run the program with +RTS -N2 to use 2 threads, for example. You should use a -N value equal to the number of CPU cores on your machine (not including Hyper-threading cores).


    It seems somewhat onerous to have flags one must set both at compile time and again at run time. Are these flags vestigial remains of the effort to add concurrency to GHC?

    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-05-17T01:22:41+00:00Added an answer on May 17, 2026 at 1:22 am

      While you’re developing the program the extra +RTS ... shouldn’t be a big deal (though I admit it struck me as odd when I first picked up Haskell). For the final (shipped) binary you can link it with static RTS options (GHC manual) by providing a C file containing char *ghc_rts_opts = "-N";.

      EDIT: Updating this question for GHC 7.x, there is now a way to specify RTS options at compile time:

      ghc -threaded -rtsopts -with-rtsopts=-N
      

      This 1) uses the threaded runtime system 2) Enables the RTS options 3) Sets the RTS option to use as many threads as there are cores available (use -Nx where x is a number to manually control the number of OS threads).

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    The Haskell wiki states that you should use Cabal as your build system. However,
    On the Haskell wiki I read that this : fib = let fib' 0
    I have followed the tutorial on the Haskell wiki about i mplementing an IRC
    I am going through the Haskell wiki books GADTS https://en.wikibooks.org/wiki/Haskell/GADT guide. I was tracking
    In Haskell, is there a way to restrict a monad M a so that
    In Haskell, how can I generate Fibonacci numbers based on the property that the
    In Haskell, lifted type products mean that there's a semantic difference between (a,b,c) and
    I read this: http://hackage.haskell.org/trac/ghc/wiki/ViewPatterns I like the idea, want to use the extension. I
    After a relatively brief text on Haskell wiki about pattern matching of records, I'm
    I set up a project according to the recommendation here: http://www.haskell.org/haskellwiki/Structure_of_a_Haskell_project How can I

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.