开发者

Multi Core Coding

开发者 https://www.devze.com 2023-04-04 05:44 出处:网络
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 acces

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:

  1. Check boost hardware_concurency()
  2. 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

  3. What kind of work is actually performed by your threads? Maybe you have some race condition like threads starvation etc.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号