English 中文(简体)
线条是用于平行的 IO 而不是 CPU 吗?
原标题:Are threads intended for parallel IO rather than CPU?

在2012年圭多范罗苏姆的Pycon演讲中,

如果您使用线条来表达它们原本的目的, OS 级别线条是用来做平行 IO 的, 不是用来做平行计算 。 < a href=" http://www.youtube.com/ watch?v=EBRMq2Ioxsc#t=3400m0s rel=“ nofollow” [来源]

传统上,关于进程五线线的讨论围绕时间安排、背景开关成本或资源共享成本之间的差异进行。

然而,我从来没有听说过或者听说过一个概念,即对于CPU密集型任务相对于IO来说,一个必然比另一个强。 如果进程和线(不一定你可以想象到的东西)之间基本上有1-1的关系,那么从CPU-Vs-IO的角度来看,这是否重要,用哪一种方法呢?

标准的书目文件不能说明这一具体索赔要求;有人知道更好的来源吗?

在设计已知在其中一个领域有瓶颈的软件时,是否常见地出现在设计这些软件时,最好相互使用?

问题回答

大多数操作系统每个过程提供多个线条 。

这些线条可不经任何互动用于简单计算,可与其他线条(通常是同一过程的线条)偶发互动计算,也可用于与I/O的短时间连发计算。

操作系统的设计通常不关心你对一条线做什么;设计者期待所有这三条线,并提供有效的机制,以便预先确定、安排执行时间表,并使可靠的线条与其他线条发生互动。

我可以相信圭多是在谈论在Python中嵌入的线条。 这些线条是设计师说他们做的。 如果他只为I/O使用这些线条,那么这些线条只用于I/O。

鉴于Python是口译员,提供计算线索是可能的,但很奇怪;由于口译员的速度往往与编译的代码一样慢10x,所以你们只有比编译的代码慢10x的平行程序。 想要同时计算的人需要快速的答案,因此倾向于不使用口译员。





相关问题
Using Java to retrieve the CPU Usage for Window s Processes

I am looking for a Java solution to finding the CPU usage for a running process in Windows. After looking around the web, there seems to be little information on a solution in Java. Keep in mind, I am ...

What resources are shared between threads?

Recently, I have been asked a question in an interview what s the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer. ...

Run a program from PowerShell with timeout

I ll write a script that runs a program and wait for it finished. But if the program is not finished within a specified time I want that the program is killed.

Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

Limit the Number of Created Processes

I have two classes: Action class, that has a method for executing VBScript files, and Item class that contains a list of Action instances. My problem is that I want to limit the number of VBScript ...

if-statement always evaluates to TRUE

Is there any reason why this script always returns "running", regardless of whether my process is started or stopped? if ps ax | grep -v grep | grep "processName" > /dev/null then echo $"...

Python library for Linux process management [closed]

Through my web interface I would like to start/stop certain processes and determine whether a started process is still running. My existing website is Python based and running on a Linux server, so ...

热门标签