什么是多线程应用程序? [英] What is a multithreaded application?

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

问题描述

我想了解有关线程的更多信息,我想知道:什么是多线程应用程序?

I am looking to learn more about threading and I wanted to know: what is a multithreaded application?

推荐答案

多线程,因为广泛的编程和执行模型允许多个线程存在于单个过程的上下文.这些线程共享进程的资源,但能够独立执行.线程编程模型为开发人员提供了有用的并发执行抽象.但是,该技术最有趣的应用可能是将其应用于单个进程以在多处理器系统上实现并行执行.

Multithreading as a widespread programming and execution model allows multiple threads to exist within the context of a single process. These threads share the process' resources but are able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. However, perhaps the most interesting application of the technology is when it is applied to a single process to enable parallel execution on a multiprocessor system.

这意味着单个流程可以具有许多不同的功能" 同时,从而使应用程序可以更好地使用可用的硬件(多个内核/处理器).线程可以在它们之间进行通信(它们具有共享内存),但是它的" rel ="noreferrer">其他

That means that a single process can have many different "functions" executing concurrently, allowing the application to better use the available hardware (multiple cores/processors). Threads can communicate between them (they have shared memory), but its a hard problem to have every thread behave well with others when accesing shared objects/memory.

当执行冗长的操作时,线程允许应用程序保持响应状态,而无需使用捕获所有应用程序循环".

Threading allows an application to remain responsive, without the use of a catch all application loop, when doing lengthy operations.

例如,非线程copy程序在复制完成之前不允许您执行任何操作.

For example, a non threaded copy program wouldn't allow you to do anything until the copy completes.

线程有助于解决复杂,冗长,独立的问题,但带来了

Threading helps with complex, lenghty, independent problems, but brings along a lot more complexity, that makes it hard even for seasoned developers.

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

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