For Programmers: Free Programming Magazines  


Home > Archive > A86 Assembler > November 2004 > Non-serializing equivalent of CPUID?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Non-serializing equivalent of CPUID?
spamtrap@crayne.org

2004-11-18, 8:56 pm


In a multithreaded application I'd like to make a call to get which
processor the each thread is running on. I can use CPUID and get the
APIC id (the first byte of EBX when EAX=1), which gives me exactly what
I want but the CPUID instruction is serializing and isn't that great
for performance.

I see Windows2003 has a system call to get the processor id, so perhaps
there is a non-serializing way to get what I want?
Any hints would be greatly appreciated! Thanks,
Brand

Tim Roberts

2004-11-18, 8:56 pm

spamtrap@crayne.org wrote:

>
>In a multithreaded application I'd like to make a call to get which
>processor the each thread is running on. I can use CPUID and get the
>APIC id (the first byte of EBX when EAX=1), which gives me exactly what
>I want but the CPUID instruction is serializing and isn't that great
>for performance.


Do you understand that this information could be wrong 2 nanoseconds after
you retrieve it? Nothing prevents the operating system from rescheduling
your thread onto a different processor at any time.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com