Re: return the "Processor ID"



Ken wrote:
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

Yes, indeed, I did write that ;-)

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

.



Relevant Pages