- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm going to write a program where one thread is busy on data aquisition from PCI card, and other threads are doing all other things. Now, I would like to assign that aquisition thread to one CPU, and other threads to the other CPU (It may be really two CPU's, or just hyper-threaded). How do I choose CPU for thread programatically in e.g. C++? Is it possible, or will it work as assigning CPU according to how much one is busy, so the other will be then assigned?
thank you very much for answering to this question
sincerely
Peter Sliwka
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've done some testing via Managed C# code with Thread Affinity and noticed a performance decline when tasking a single HT/Multi-core processor by thread as opposed to usingThreadPool Queue.
Im far (quite literally in outter space) from being an expert in this area but heck I might as well throw my comments out and see what other have to say.. I know I have quite a bit of learning to do anyway..
Kevin (Intel ASP.Net Web dude...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From your description "single HT/Multi-core processor" Windows will percieve 4 processors when in fact you have 2 cores, each with two HT thread capability. What you want is one core dedicated to your applicationi (both HT threads on that core reserved but only one in use).
I think your best results (for the priorityapplication thread) would be to isolate each core. With "processors" 0 and 1 on one core and "processors" 2 and 3 on the second core. Using the Task Manager | Processes tab | right-click on each ofnot-your-application processies and set affinity to restrict processing to the 1st core (cpu0 and cpu1). Then modify your application to set affinity to CPU2 (2nd core).
If you start any applications after initialization (Task Manager setting of affinity) then you will have to reset affinity on the new processes.
Experiment running this way and check results.
Jim Dempsey
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page