I'm sorry. I can't make the connection between licensing and multithreading. Am I missing something? Besides, can a thread even run accross multiple processors?
One thread can run on 1 cpu, but if you are using multithreading in your app, two threads of the same application can run on two cpu's. Or just on one, that choice is made by the OS. I dont know, but perhaps an OS can even move a thread from one cpu to another if the load on the orignal cpu becomes to high.
I think natarius wants to limit the use of multiple processors if ppl buy a cheaper license. I think all of the proprietary professional databases (MS SQL, Oracle, etc.) have this type of licensing where wanting to use additional cpu's to speed up the database means paying more money .
This should be possible with the win32api SetProcessAffinityMask I think. Here is some reading on SetProcessAffinityMask
The corresponding GetProcessAffinityMask
And some overall information from microsoft about using these methods.
I dont know if the above mechanisme works on logical CPUs or physical CPUs. 1 single core Intel hyperthreaded CPU is 1 physical cpu, but 2 logical cpus. However a true dualcore processor is 2 physical cpus and 2 logical cpus.
Windows is a SMP (symmetric multiprocessing) based system - this means threads can be scheduled on any availabe cpu (physical or virtual) by the OS regardless.
Apart from one or two core OS threads which always run on the first cpu other threads can (and will) freely move between cpus based on cpu availability.
Although you could (potentially) use theSetProcessAffinityMask I'm not entirely sure how this would work with .Net as the runtime is multithreaded anyway.
Although you could (potentially) use theSetProcessAffinityMask I'm not entirely sure how this would work with .Net as the runtime is multithreaded anyway.
As far as I understand it (ok, didnt try it myself ) multithreading isnt important for the API. The API works on process level and forces the OS to schedule the process on the amount of CPU's indicated.
This can be any kind of process. dotNet might be multithreaded, but COM objects that are free-threaded can also have multiple threads running at the same time, so I dont think multithreading makes it impossible. It would just mean that the multiple threads are all running on the same CPU -> for the process it would be a single cpu box.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.