什么是多线程成功标准? [英] What is multithreading Success Criteria ?

查看:113
本文介绍了什么是多线程成功标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我目前正在使用多线程编写程序.多线程用于充分利用CPU.
我当前的程序运行良好,但在整个运行过程中,CPU利用率约为40-50%.

根据多线程理论,它至少应在一段时间内为100%.

由于即使在执行多线程之后,CPU利用率也仅为50%,因此可以将其视为失败的多线程吗?

我正在使用没有超线程的单核处理器.该应用程序不允许人工干预.它具有一个计算很多的功能. 1个gui线程+ 1个工作线程.


问:

对于成功实现多线程的应用程序来说,这是一条规则吗,CPU利用率必须为100%.
少被视为失败的多线程??

对于成功的多线程,在
上理想的CPU使用率应该是什么
1.单核和
2.多核处理器.

所有内核都应使用100%或知道多线程是否成功的确切标准是什么.

或以其他方式询问

1.在运行我的程序时,如果CPU利用率低于100%,那么在程序设计和/或编码方面是否有任何改进的范围?

100%不必一定是字面值,但很高,例如90%或更高,因为当前利用率约为50%.


专家请发表评论.

Hi i am currently writing a programme using multithreading. Multithreading is used to utilize CPU fully.
my current programme is running well but CPU utilization is around 40-50% for the entire running.

As per the multithreading theory it should be 100% for at lest some time.

Since even after doing multi threading the CPU utilization is 50% only, can it be treated as failed multithreading ??

I am using a single core processor without hyperthreading. The application do not allow human intervention. it has a function which calculates a lot. one gui thread + one worker thread.


Q.

Is it a rule that for a application in which multithreading is successfully implemented CPU utilization MUST be 100%.
anything less be treated as failed multithreading ??

For successful multithreading what should be the ideal CPU utilizaion on

1.single core and
2.multicore processors.

All cores should be used to 100% or what is the exact criteria to know if the multithreadig is successful.

Or asking in different way

1. while running my program if CPU utilization is below 100% is there any scope of improvement in terms of design of program and / or coding ??

100% need not be literal but very high say 90% or above as currently the utilization is about 50%.


Experts please comment.

推荐答案

这两个条件都是胡说八道.使用线程有很多原因,但是仅对于某些任务,才需要100%的CPU使用率.此类任务的示例是无需人工干预的持久计算.有许多这样的任务,例如复杂模型的数值模拟.但!在所有这些情况下,CPU利用率为100%的问题并不是真正的问题.如果运行一项这样的任务,单CPU计算机将始终处于100%繁忙状态.在具有多个内核/CPU的系统的情况下,问题更为复杂,但并没有减少到100%CPU使用率的问题.您可以轻松地保持100%的CPU繁忙,而仍然无法令人满意地完成任务的吞吐量(即使没有线程从其本地角度来看,正在做任何愚蠢的事情,例如旋转等待).真正的目标是尽快完成给定的计算量,这是一个非常不同的问题,复杂得多.

这样,CPU使用率达到100%的问题大部分是人为的,与真正困难的并行计算效率问题没有太大关系.

—SA
Both criteria are nonsense. There are many reasons to use threading, but only for some tasks 100% of CPU usage is desired. Example of such task is long-lasting calculations without human intervention. There are many such tasks, such as numerical simulation of complex models. But! In all these cases the problem of 100% CPU utilization is not really a problem. If you run one such task, a single-CPU computer will be 100% busy anyway. The case of the system with multiple cores/CPUs the problem is more complex, but no reduced to the problem of 100% CPU usage. You can easily keep 100% CPU busy still having the effective throughput of your task unsatisfactory (even when no thread is doing anything stupid from its local standpoint, such as spin-wait). The real goal it to complete the given volume of calculation sooner, which is a very different problem, much more complex.

In this way, the problem of 100% CPU utilization is mostly artificial and is not much relevant to the really difficult problem of effectiveness of parallel calculation.

—SA


您必须运行带有多处理器(虚拟)的处理器.结果,您将看到该处理器上的最大利用率仅为50%.
You must be running a processor with mutliple processors (virtual). As a result, you will see a maximum utilization of only 50% on that processor.


这篇关于什么是多线程成功标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆