Re: return the "Processor ID"




Josef Moellers wrote:
Roger Leigh wrote:
greg.yang@xxxxxxxxx writes:


I want to ask which function/system call can return the ID of the
processor that current thread is running on.


Is this a useful question to ask? Your process could be scheduled at
any moment on any CPU, so the answer is not going to be meaningful,
since it could be wrong as soon as you get it.

It could even change _while_ you're getting it:
CPU0: running application
CPU0: int 0x80 (GetCPUID)
CPU0: getting "0", about to return to user mode
CPU0: hit by interrupt, forcing current process to reschedule
CPU1: resuming GetCPUID into user mode
CPU1: running application

--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

.



Relevant Pages

  • Re: return the "Processor ID"
    ... CPU0: running application ... about to return to user mode ... CPU1: resuming GetCPUID into user mode ...
    (comp.os.linux.development.apps)
  • Re: cpufreq probs dual core intel
    ... cpu0: on acpi0 ... <Enhanced SpeedStep Frequency Control> on cpu0 ... cpu1: on acpi0 ...
    (freebsd-current)
  • Re: [git] CFS-devel, latest code
    ... Note that parent entities for a task is per-cpu. ... which is different from its parent entity on CPU0. ... For enqueue of higher level entities, ... moves from CPU0 to CPU1. ...
    (Linux-Kernel)
  • Re: x86-microcode: get rid of set_cpus_allowed()
    ... I've seen that sometimes ucode of CPU0 was not ... updated and sometimes CPU1 and CPU2 were not updated. ... 34, 85609 Dornach b. ...
    (Linux-Kernel)
  • cpufreq probs dual core intel
    ... cpu0: on acpi0 ... <Enhanced SpeedStep Frequency Control> on cpu0 ... cpu1: on acpi0 ...
    (freebsd-current)