Multi Core Coding
I'm writing this c++ application that uses Boost threading and开发者_Python百科 SFML to use TCP and UDP sockets. I have a 4 code Xeon CPU but it seems like I'm using only 1 core. How can I get access to the full 4 cores?
Thread assignment is up to the OS you are using. Also please tell what do you mean by "but it seems like I'm using only 1 core" exactly.
However you can do some research:
- Check boost hardware_concurency()
If you are using Windows there is a nice program that will show you how many threads are running in your application, which thread is associated to specific HW core and usage (click properties and threads tab): http://technet.microsoft.com/en-us/sysinternals/bb896653
What kind of work is actually performed by your threads? Maybe you have some race condition like threads starvation etc.
AFAIK there is no sense in making several threads to send some data only because all data is traveling through kernel driver and is serialized at the end.
BR
精彩评论