Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted
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?
[sIGPIC]e[/sIGPIC]
Posted

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.

Nothing is as illusive as 'the last bug'.
  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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.

Nothing is as illusive as 'the last bug'.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...