1

Wouldn't it be clever if a programmer decides to code his programs the way so that they always use the last CPU core available?

I mean: on 8-core: CPU 7 > CPU 6 > CPU 5...

I mean, if every other program is used to start using CPU 0 and then to move upwards... This could be an advantage...

Comments
  • 0
  • 0
    It's called "processor affinity," and it doesn't have the effect you think.

    Operating systems run programs on whichever core is sitting idle. Affinity is only useful for saying, "plz to not preempt."
  • 0
    @greyfade then how can it be that a single core game like Rollercoaster tycoon 2 seems always to use CPU0 on multicore systems? On my fx8320 when playing CPU 1-7 is nearly idle while 0 is under heavy load...

    I know that this is a game not able to multithread. But why isn't the OS giving another core? Or is itself switching the cores because something singlethread runs?
    And some programs like audio converters simply grab one track per CPU core during conversion I've recognized....
  • 0
    @paradonym sorry for slow reply.

    The game may be setting affinity (which is a trivial function call) or the OS simply has no reason to schedule the game on another core.

    Process scheduling is a bit of a black art, but granting affinity to a process is a common scheduling strategy that is meant to minimize scheduling interrupts, which are often expensive.
Add Comment