如何编写多核多线程应用程序?
我有一个在服务器中运行的应用程序,我想使用该服务器的整个资源。那就是多核服务器。我需要使用所有内存和所有核心并一次运行最大到最大线程的多线程设计。
我怎样才能实现这个多线程。请建议我可能的设计和代码 ID。
谢谢 潘卡吉·米什拉
I have one application that is running in server and I want to use whole resource of that server. That is multicore server. And I need omulti thread design that use all memory and all core and run max to max thread at a time.
How Can I implement this multithreading. Please suggest me design and code id possible.
Thanks
Pankaj mishra
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须明确提及更多细节。可能有很多因素:
1) 如果它是纯粹的计算作业,则据信有最大(核心数 +1)个线程在工作。
2)如果它有I/O、同步,那么你需要记下它的频率,然后相应地缩放它。
搜索阿姆达尔定律。也就是说,即使增加核心数量,也无法提高标记后的生产率。
一般来说,这取决于很多因素
You will have to please expplicitely mention more details. There can be a lot of factors:
1) If its a pure computational job, then it is believed to have the maximum (# of cores +1) threads working.
2) If it has I/O, synchronization, then you need to jot down how frequent it is and then accordingly scale it.
Search Amdahl's law. Which says that you cant increase the productivity after a mark even if you increase the number of cores.
In general it can depend on a lot of factors