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

  • Home
  • SEARCH
  • 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 7636815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:46:48+00:00 2026-05-31T07:46:48+00:00

Assuming a single machine with 8 cores. In Haskell, you can compile using the

  • 0

Assuming a single machine with 8 cores.
In Haskell, you can compile using the threaded option, then during runtime use +RTS -Nx to specify the number of cores to be used. e.g.

$ myprg args // sequential run
$ myprg args +RTS -N1 // parallel run on 1..8 cores
$ myprg args +RTS -N2
$ myprg args +RTS -N4
$ myprg args +RTS -N8

From this, you get the runtimes using increasing number of cores, which you can then use to get speedups and plot a graph.

How would you do this in F#, assuming I have a parallel program e.g. using a parallel map in the code?

EDIT:
I found there are ParallelOptions e.g. MaxDegreeOfParallelism which may be what I need but not sure about its exact behaviour, and I would have to use it programmatically which is fine as long as it behaves as expected i.e. MaxDegreeOfParallelism = num of cores program should use, and not parallel ‘tasks’ or threads.

EDIT:
ProcessorAffinity indeed limits the number of cores to use but it seems that it is not properly implemented in Mono. I checked on Windows and it seems to work. Though it is not really a good idea to use. The runtime system should be able to decide better how to manage and schedule tasks. Also, MaxDegreeOfParallelism is about “parallelism level” which basically sets the number of tasks generated, thus could be used to vary granularity.

  • 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-31T07:46:49+00:00Added an answer on May 31, 2026 at 7:46 am

    F# builds a native .NET assembly. An assembly follows the rules specified for runtime (CLR) which by default has affinity on all CPU cores. You can limit CLR for a fewer number of cores by setting System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity.

    This answer seems to be incomplete for Mono environment. ProcessorAffinity value is a bit mask, so 0 is certainly an invalid condition. I’m also wondering why the setter did not throw an exception as described in MSDN.

    I would use schedutils to check Mono affinity and also check if MONO_NO_SMP environment flag is not set.

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

Sidebar

Related Questions

Assuming you can't use LINQ for whatever reason, is it a better practice to
I have an old C++ library which has been designed for use in single-threaded
Assuming that I must do this substitution using a single substitution, what is the
Assuming a JavaScript-based single-page application is returned by the server on the initial request.
What RegEx would replace a single 'm' letter with (e.g.) a number, assuming that
Leaving aside the question of whether you should serve single or multiple stylesheets, assuming
Assuming I have an open source web server or proxy I can enhance, let's
I know that you can bang away at GUID generation on single and multiple
Assuming I have two SQL tables consisting of a single column, i.e. Table 1
I am using a generic approach to receiving a single row from any Oracle

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.