Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: use dual-core or quad-core

by BrowserUk (Patriarch)
on May 20, 2008 at 09:35 UTC ( #687563=note: print w/replies, xml ) Need Help??


in reply to Re: use dual-core or quad-core
in thread use dual-core or quad-core

A single tasking, non-forking, single threaded process--a bog standard program--will be run on whichever processor is available when it is next due a timeslice on any SMP system, including Linux. It just won't be able to use more than one concurrently.

Priorities have nothing to do with it. (See *).


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^3: use dual-core or quad-core
by tirwhan (Abbot) on May 20, 2008 at 09:55 UTC

    In principle you are correct. But in practice, renicing a process to the highest priority is the most efficient tactic for keeping it running on a single CPU as continuously as possible while not disrupting the rest of the system (see man sched_setscheduler on why). There's also taskset, which actually influences processor affinity (which is what you are talking about), but that doesn't have much practical use for this particular case. In fact, if you want your process to run on a CPU core as continuously as possible (and you're not fussy about which exact core it is, which I don't see why the OP would be), then you want the OS scheduler to switch the process to a different core for the very rare case when this is more efficient. Thus, setting processor affinity would do more harm than good.


    All dogma is stupid.

      Interesting. I will have to look up to see if there are any equivalents on the OPs on dual-core, windows xp system.

      There are the 6 levels of processes priority which are analogous to the three described in sched_setScheduler, but they are further influenced Dynamic Priority Boosts. And that is further influenced by whether the system is configured as a workstation or server. And if it's a workstation then it's influenced once more by whether the workstation has Foreground Priority Boost enabled.

      I also think I remember reading about the NT scheduler tending to have a 'natural affinity' to keeping a cpu-bound process (or maybe thread, but same thing in a single threaded application) running on the same cpu or core, but I can't lay my hands on a reference for that just now.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://687563]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-12-05 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?