From 2a103c7d763c22dc9b0562dac1184ffb950da5ce Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 16 Dec 2014 11:42:42 +0000 Subject: [PATCH] Improve documentation for -N and -qa (#9890) --- docs/users_guide/using.xml | 54 ++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 499e486572..0504fb5d41 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -3308,13 +3308,29 @@ data D = D !C RTS option Use x simultaneous threads when - running the program. Normally x - should be chosen to match the number of CPU cores on the - machineWhether hyperthreading cores should be counted or not is an - open question; please feel free to experiment and let us know what - results you find.. For example, - on a dual-core machine we would probably use - +RTS -N2 -RTS. + running the program. + + The runtime manages a set of virtual processors, + which we call capabilities, the + number of which is determined by the + option. Each capability can run one Haskell thread at a + time, so the number of capabilities is equal to the + number of Haskell threads that can run physically in + parallel. A capability is animated by one or more OS + threads; the runtime manages a pool of OS threads for + each capability, so that if a Haskell thread makes a + foreign call (see ) + another OS thread can take over that capability. + + + Normally x should be + chosen to match the number of CPU cores on the + machineWhether hyperthreading cores + should be counted or not is an open question; please + feel free to experiment and let us know what results you + find.. For example, on a dual-core + machine we would probably use +RTS -N2 + -RTS. Omitting x, i.e. +RTS -N -RTS, lets the runtime @@ -3331,10 +3347,11 @@ data D = D !C ). The current value of the option - is available to the Haskell program - via Control.Concurrent.getNumCapabilities, and - it may be changed while the program is running by - calling Control.Concurrent.setNumCapabilities. + is available to the Haskell program via + Control.Concurrent.getNumCapabilities, + and it may be changed while the program is running by + calling + Control.Concurrent.setNumCapabilities. @@ -3349,9 +3366,18 @@ data D = D !C option Use the OS's affinity facilities to try to pin OS - threads to CPU cores. This is an experimental feature, - and may or may not be useful. Please let us know - whether it helps for you! + threads to CPU cores. + + When this option is enabled, the OS threads for a + capability i are bound to the CPU + core i using the API provided by the + OS for setting thread affinity. e.g. on Linux + GHC uses sched_setaffinity(). + + Depending on your workload and the other activity on + the machine, this may or may not result in a performance + improvement. We recommend trying it out and measuring the + difference. -- GitLab