-
February 21st, 2008, 07:25 AM
#1
running thread on specified core
Hi all,
Is ii possible to run a thread on a specified core? I have an application that receives images from a video cammera and applies some algorithms on these images before display on the screen. Because it critical that I don't loose any frame I was thinking about using one core to aquire images from the frame grabber and the other core to apply algorithms... Is that possible?
Thanks!
You liked it? Please show your gratitude and rate it!
There is no 'patch' for stupidity.
-
February 21st, 2008, 08:01 AM
#2
Re: running thread on specified core
Take a look at SetThreadAffinityMask.
- petter
-
February 21st, 2008, 08:11 AM
#3
Re: running thread on specified core
aha.. that's exaclty what I was looking for. Now to put it in action
Thanks!
You liked it? Please show your gratitude and rate it!
There is no 'patch' for stupidity.
-
February 21st, 2008, 12:05 PM
#4
Re: running thread on specified core
It's usually a mistake to try and second-guess the built-in thread scheduler of Windows. It almost always can do a better job than you can.
Let us know if your idea works. It might turn out to be an example of a situation where the programmer does a better job than the scheduler.
Mike
-
February 22nd, 2008, 12:28 AM
#5
Re: running thread on specified core
Hmm, what if that core which you specified is busy with other single thread application or other application also specified that core or 2 and more instances of your application is running. I also don't know what may have happened in these scenario.
You will never know what applications are running on your users' machines, unless this application always run in a controlled environment, for example, application to control the running of a machine in a factory.
Let me know too if the processor affinity method work.
-
February 22nd, 2008, 02:14 AM
#6
Re: running thread on specified core
Originally Posted by vma
Hi all,
Is ii possible to run a thread on a specified core? I have an application that receives images from a video cammera and applies some algorithms on these images before display on the screen. Because it critical that I don't loose any frame I was thinking about using one core to aquire images from the frame grabber and the other core to apply algorithms... Is that possible?
Thanks!
Have you experienced frame losts when the threads are scheduled on cores by the OS? The approach you proposed is not error-proof, like the other mentioned. I think the chances are it won't work better.
-
February 22nd, 2008, 02:18 AM
#7
Re: running thread on specified core
Thanks for your observations... What to say? I will give it a try and see what happens I will let you know if it worked better or not The thing is that there is an application for a microcontroller and the final client is this. There we don't have this problem as there is no other procees like on the PC. But my application will be on PC and it is just to test the algorithms that will go into this microcontroller.
Last edited by vma; February 22nd, 2008 at 02:22 AM.
You liked it? Please show your gratitude and rate it!
There is no 'patch' for stupidity.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|