为什么异步进程不称为同步进程?

发布于 2024-08-08 06:51:03 字数 331 浏览 2 评论 0原文

所以我对这个术语有点困惑。

每个人都将“异步”计算称为在单独的线程上运行不同的进程,这给人一种这些进程同时运行的错觉。

这不是异步这个词的定义。

a⋅syn⋅chro⋅nous
–adjective 
1. not occurring at the same time. 
2. (of a computer or other electrical machine) having each operation started only after the preceding operation is completed. 

我在这里不明白什么?

So I'm a little confused by this terminology.

Everyone refers to "Asynchronous" computing as running different processes on seperate threads, which gives the illusion that these processes are running at the same time.

This is not the definition of the word asynchronous.

a⋅syn⋅chro⋅nous
–adjective 
1. not occurring at the same time. 
2. (of a computer or other electrical machine) having each operation started only after the preceding operation is completed. 

What am I not understanding here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

牵你的手,一向走下去 2024-08-15 06:51:03

这意味着两个线程不同步运行,也就是说,它们不运行在同一时间线上。

我认为这是计算机科学家在用词方面过于聪明的一个例子。

在这种情况下,同步意味着两个线程同时开始和结束。从这个意义上讲,异步意味着两个线程都可以根据需要自由启动、执行和结束。

It means that the two threads are not running in sync, that is, they are not both running on the same timeline.

I think it's a case of computer scientists being too clever about their use of words.

Synchronisation, in this context, would suggest that both threads start and end at the same time. Asynchrony in this sense, means both threads are free to start, execute and end as they require.

ㄖ落Θ余辉 2024-08-15 06:51:03

我相信该术语首先用于同步与异步通信。同步意味着两个通信部分有一个共同的时钟信号来运行,因此它们是并行运行的。相反,异步通信有一个就绪信号,因此一部分会请求数据并在信号可用时返回信号。

然后,这些术语适应了流程,但由于存在明显的差异,术语的某些方面的工作方式有所不同。对于单线程进程,请求执行某些操作的自然方法是进行同步调用,将控制权转移到子进程,然后在完成时返回控制权,然后进程继续。

异步调用的工作原理与异步通信类似,即您发送要完成某件事的请求,并且执行该操作的进程在完成时返回一个信号。术语用法的区别在于,对于进程来说,异步处理是进程并行运行的,而对于通信来说,是并行运行的同步通信。

因此,“计算机或电机”的范围确实太宽,无法正确定义该术语,因为对于不同的技术,它的使用方式略有不同。

I believe that the term was first used for synchronous vs. asynchronous communication. There synchronous means that the two communicating parts have a common clock signal that they run by, so they run in parallel. Asynchronous communication instead has a ready signal, so one part asks for data and gets a signal back when it's available.

The terms was then adapted to processes, but as there are obvious differences some aspects of the terms work differently. For a single thread process the natural way to request for something to be done is to make a synchronous call that transfers control to the subprocess, and then control is returned when it's done, and the process continues.

An asynchronous call works just like asynchronous communication in the aspect that you send a request for something to be done, and the process doing it returns a signal when it's done. The difference in the usage of the terms is that for processes it's in the asynchronous processing that the processes runs in parallel, while for communication it is the synchronous communication that run in parallel.

So "computer or electrical machine" is really a too wide scope for making a correct definition of the term, as it's used in slightly different ways for different techniques.

一世旳自豪 2024-08-15 06:51:03

“同步”一词意味着函数调用将与其他事件同步

异步意味着不会发生此类同步。

看起来你在那里的定义实际上应该是“并发”或其他东西的定义。这个定义看起来是错误的。


PS:

这是维基词典的定义:

异步

  1. 不同步;发生在不同的时间。
  2. (计算,请求或消息)允许客户端在处理过程中继续。

这恰好与您发布的内容完全相反。

The word "synchronous" implies that a function call will be synchronized with some other event.

Asynchronous implies that no such synchronization occurs.

It seems like the definition that you have there should really be the definition for "concurrent," or something. That definition looks wrong.


PS:

Here is the wiktionary definition:

asynchronous

  1. Not synchronous; occurring at different times.
  2. (computing, of a request or a message) allowing the client to continue during processing.

Which just so happens to be the exact opposite of what you posted.

忘羡 2024-08-15 06:51:03

我猜这是因为它们不同步;)

换句话说......如果一个进程被停止、杀死或正在等待某事,另一个进程将继续

I would guess it's because they are not synchronized ;)

In other words... if one process gets stopped, killed, or is waiting for something, the other will carry on

小帐篷 2024-08-15 06:51:03

我认为这里的大多数答案都略有不同。

异步意味着“不同时发生”。

在线程的特定情况下:

  • 同步意味着“立即执行此代码”。
  • 异步意味着“将这项工作排入不同的线程该线程将在未来某个不确定的时间执行

这通常允许您“同时做两件事”,因为以下原因:

  • 一个线程只是等待(例如数据到达串行端口)因此处于睡眠状态
  • 您有多个处理器,因此两个线程可以同时运行。

然而,即使有 128 个处理器核心,情况也是一样的:工作将在“将来的某个时间”(如果可能是不久的将来)而不是“现在”执行。

I think there's a slant that is slightly different to most of the answers here.

Asynchronous means "not happening at the same time".

In the specific case of threading:

  • Synchronous means "execute this code now".
  • Asynchronous means "enqueue this work on a different thread that will be executed at some indeterminate time in the future"

This usually allows you to "do two things at once" because of reasons like:

  • one thread is just waiting (e.g. for data to arrive on a serial port) so is asleep
  • You have multiple processors, so the two threads can run concurrently.

However, even with 128 processor cores, the case is the same: the work will be executed "at some time in the future" (if perhaps the very near future) rather than "now".

芸娘子的小脾气 2024-08-15 06:51:03

您的第二个定义在这里更有用:

2. [...] having each operation started only after the preceding operation is completed.

当您进行异步调用时,该调用可能无法在下一个操作开始之前完成。当调用是同步的时,就会如此。

Your second definition is more helpful here:

2. [...] having each operation started only after the preceding operation is completed.

When you make an asynchronous call, that call might not be completed before the next operation is started. When the call is synchronous, it will be.

乱了心跳 2024-08-15 06:51:03

这实际上意味着异步事件独立于其他事件发生,而同步事件则依赖于其他事件发生。

It really means that an asynchronous event is happening independently of other events whereas a synchronous event would be happening dependent of other events.

很酷不放纵 2024-08-15 06:51:03

就像:Flammable、Inflammable(意思是一样的)

说真的——这只是英语的怪癖之一。这确实没有意义。你可以尝试解释它,但证明相反的含义也同样容易。

It's like: Flammable, Inflammable ( which mean the same thing )

Seriously -- it's just one of those quirks of the English language. It doesn't really make sense. You can try to explain it, but it would be just as easy to justify the reverse meanings.

初与友歌 2024-08-15 06:51:03

这里的许多答案都不正确。 IN-dependently 有一个开头助词,写着 NOT dependently,就像 A-synchronous 一样,但是 dependent 和 synchronous 的含义不一样! :D

所以三个依赖者会等待命令,因为他们依赖于命令,但他们等待,所以他们不同步。

在英语和任何其他具有 a、syn 和 chrono 共同词根的语言中(意大利语:asincrono;西班牙语:asincrónico;法语:
异步;希腊语:a=不是syn=在一起chronos=时间)它的意思完全相反。

这个术语完全违反直觉。异步函数是同步的,它们同时发生,这就是它们的力量。它们不等待,它们不依赖,它们不让用户等待,但所有这些“不”都指除了同步性之外的任何东西:)

唯一可能正确的答案是“时钟”,尽管它仍然令人困惑。我个人的解读是这样的:

“一位教授有一间办公室,他同步号召学生前来。他在大学主礼堂大声说道:‘嘿,想和我说话的人应该早上 10 点来。明天。”,或者简单地贴出一个标牌,上面写着同样的内容。

结果:早上 10 点,你会看到人们排着长队,所以他们在同一时间进来,然后“在过程中堆积起来”。 。
所以教授认为学生最好不要在队列中浪费时间(并进行同步操作,即在生活中同时做并行的事情,这就是混乱的来源)。

他决定学生可以代替他进行异步通话,也就是说,每次一个学生结束与他的谈话时,学生可以打电话给另一个学生,说教授可以在一个学生可以做任何他们喜欢的事情的房间里自由交谈。同时。因此,每个学生都没有一个同步呼叫(早上 10 点,所有人的时间相同),但根据教授办公室每次讨论所需的时间,他们有 10、10.10、10.18、10.27... 等。”

这就是拥有相同时钟的意义吗,@Guffa?

Many of the answers here are not correct. IN-dependently has a beginning particle that says NOT dependently, just like A-synchronous, but the meaning of dependent and synchronous are not the same! :D

So three dependent persons would wait for an order, because they are dependent to the order, but they wait, so they are not synchronous.

In english and any other language with common roots with a, syn and chrono (italian: asincrono; spanish: asincrónico; french:
asynchrone; greek: a= not syn=together chronos=time)it means exactly the opposite.

The terminology is UTTERLY counter-intiutive. Async functions ARE synchronous, they happen at the same time, and that's their power. They DO NOT wait, they DO NOT depend, they DO NOT hold the user waiting, but all those NOTs refer to anything but synchronicity :)

The only answer possibly right is the CLOCK one, although it is still confusing. My personal interpretation is this story:

"A professor has an office, and he makes SYNCHRONOUS CALLS for students to come. He says out loud in the main university hall: 'Hey guys who wants to talk to me should come at 10 in the morning tomorrow.', or simply puts a sign saying the same stuff.

RESULT: at 10 in the morning you see a long queue. People had the same time so they came in in the same moment and they got "piled up in the process".
So the professor thinks it would be nice for students not to waste time in the queue (and do synchronous operations, that is, do parallel stuff in their lives at the same time, and that's where the confusion comes).

He decides students can substitute him in making ASYNCHRONOUS CALLS, that is, every time a student ends talking with him, the students may, e.g., call another student saying the professor is free to talk, in a room where students may do whatever they like in the meantime. So every student does not have a single SYNCHRONOUS CALL (10 in the morning, the same time for all) but they have 10, 10.10, 10.18, 10.27.. etc. according to the needed time for each discussion in the professor office."

Is that the meaning of having the same clock, @Guffa?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文