Singlethread, Multithread, Synchronous, Asynchronous - How do these combine?

76 Views Asked by At

Every illustration and explanation concerning this topic that I came across do not seem to be consistent with each other.

I illustrated my understanding of the combinations of these concepts. Can anyone confirm if its correct or erroneous?

The execution timeline in the illustration goes from left to right.

enter image description here

1

There are 1 best solutions below

0
Solomon Slow On

This is an extended comment, not an answer


Your pictures show threads executing tasks. IMO, that is unnecessary.

I think that part of what you are struggling with is the fact that threads belong to a lower layer of abstraction than anything that is called async in any programming system (i.e., in any language or library or framework.) If I may offer a weak analogy; If an async system is like a parcel delivery service, then tasks are like the packages that need to be delivered, and threads are like the trucks that carry them. If you want to understand how a truck works, you don't need to know specifics of the cargo that it carries. But if you want to know how FedEx works, then talking about the packages—where they are supposed to go, when they are supposed to arrive—is the very heart of the matter.

Note: I am not saying that every async feature in every programming system that has one is built on a lower layer of threads, but I would not be surprised if that was true in at least a few cases.

Anyway, my point is, if you are trying to draw a picture that illustrates the scheduling of N threads on M processors (where N > M), then there is no need to mention "task" anywhere. It only complicates the picture.


P.S.; You said, "Asynchronous," but you did not mention any specific programming language or library or framework. IMO, "asynchronous" is a vague idea—not nearly as well defined as "thread." If you want to know more about some specific async feature of some language or library or framework, then you should mention it by name. They don't necessarily all work in the same way.