NASM Forum > Programming with NASM

multicore multiprocessor machine

(1/1)

alexBishop:
Can anyone show me how to detect if a computer has more than one cpu, and also how to use the extra processors (run different code on each cpu by changing the eip register of each cpu). ???

Frank Kotler:
Always embarrasing to google for something and find a link to me saying "Jeez, I don't know."! This is still what I don't know:

http://coding.derkeiler.com/Archive/Assembler/comp.lang.asm.x86/2007-07/msg00239.html

Note the typo! Should be "eax=0"!

This seems better...

http://software.intel.com/en-us/articles/multi-core-detect/

I have also seen reference to eax=80000008h...

I can't help ya with how to use 'em, since I've only got one... not 26! :)

Best,
Frank

Keith Kanios:
Review this OSDev.org Forum Thread.

menemenetekel:
Hi,

if you want to use multiple processors in parallel simply start parallel threads using mostly this functions:

extern      CreateThread
extern      CloseHandle
extern      ResumeThread
extern      SuspendThread
extern      SetThreadPriority
extern      GetCurrentThreadId
extern      WaitForMultipleObjects
...
All from kernel32.dll

Because those threads (by default - it's possible but not recommended to assign them to target CPUs manually) will be distributed to all available CPUs rsp. cores by OS controlled thread dispatcher(s) you need not to know the number of CPUs...
But if you want your program to know this number the simplest way would be to ask the environment variable NUMBER_OF_PROCESSORS

Cheers,
Mene

Navigation

[0] Message Index

Go to full version