单线程应用程序是死技术吗? [英] Are single-threaded applications a dead technology?

查看:164
本文介绍了单线程应用程序是死技术吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚买了一部新的,价值1000美元的笔记本电脑,一台面向消费者,非开发商市场,查看规格,惊讶地发现它是双核处理器的标准。 p>

这导致了一个问题:随着多核机器成为常态,是否已经正确写入单线程应用程序了?



除了可以合理地预期完全适合其将运行的最弱系统的单个处理器的单个核心的简单应用之外,将应用在所有一个当应用程序没有给出关于如何优化这样的分割的指导时,现代操作系统在核心上传播它们的执行的方式,线程会严重退化。

解决方案

由于线程总是给应用程序增加额外的复杂性,我相信单线程应用程序总是有它们的位置。



即使单核处理器完全过时,单线程程序也会消失。



双核,特别是在消费市场,是多任务处理的理想选择。如果每个应用程序都使用每个处理器核心,那么我们可能遇到与单核处理器相同的问题。



我说不要麻烦,开始mulithreading一切。 保留在一个主题中,除非有很好的理由。




I just bought a new, sub-US$1,000 laptop, one aimed squarely at the consumer, non-developer market and, looking over the specs, was surprised to find that it came standard with a dual-core processor.

This led me to the question: with multicore machines becoming the norm, is it ever correct to write a single-threaded application anymore?

Excepting trivial applications, which can reasonably be expected to fit entirely within a single core of a single processor of the weakest system on which it will run, will an application which runs in all one thread be seriously degraded by the way modern OSs spread their execution across cores when no guidance is given by the application as to how to optimize such a split?

解决方案

Since threading always adds extra complexity to applications, I believe that single threaded applications will always have their place.

Not even when single core processors are completely obsolete will single threaded programming be gone.

Dual cores, especially in the consumer market, are great for multitasking. If every app takes every processor core it possibly can we will run into the same problems we had with single core processors.

I say don't go nuts and start mulithreading everything. Keep it in one thread unless there is a good reason not too.

这篇关于单线程应用程序是死技术吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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