English 中文(简体)
难道吗?
原标题:Is Python Asynchronous asyncio parallelism?

Can t find answers even in ChatGPT. My argue is : When executing a one thread asyncio task, run 10000 tasks,

async def task():
    async def func():
            return 1+1000
    result = await func()

What talked with ChatGPT is, when await executed, the one thread loop manager put a "pause" tag on the current task, which the function: func() running in background My question is: is it true parallelism or how it works?

The loop execute the calculation of the func() see if it is completed even when it has "pause" tag? IT IS TURE PARALLELISM?.

That s why it will know it the task is completed. So when loop manager is running, 500 func() is running, is it parallelism? It is parallelism involved, how they use the cores? Also, anybody knows the exactly moment like the deep depth, how the manager knows the task is complete, an call back?

我与ChatGPT保持接触,但我仍然不知所见的回答说,吉卜赛人“是一对一对一,一对不是平行的”,但显然说,管理着500项职能,并在SAME TPAS上任管理人,这是平行的。 在一个核心或多个核心中?

问题回答

它是一对一的,一对二是平行的,正如查谟和克什米尔民主运动正确产生的。 如果你试图同时撰写500项方案,就好像。 你可以从相互编码转向其他,你将“在撰写500项方案的过程中”改写,但你当时只重写了其中一项方案的准则——你可以同时制定两个方案,为此需要两个方案。 在这里,你需要两个核心同时运行。

“当管理者开业时,500英亩())正在运行,它是否是平行的?”

“平行参与,它们如何利用核心?” 一切照旧,单单是核心,单一进程刚刚从任务转向任务。

“[......]管理人员如何知道任务已经完成,又要回头?”——一旦所有任务完成,总体工作就已完成。

“[......]但显然,作为SAME TPAS的500项职能和校对管理人员,这并不是平行的,而是实际上不是同时运行的;其中有些或全部可能已经启动,但管理人员之间正在转向发展这些职能,只是在某个时候取得进展。

"In one core or many cores?" Just one.

Look at multiprocessing for actual parallelism, but don t assume parallel execution is automatically faster. There s a lot of overhead involved in running work in parallel on a CPU and your code needs to be well-designed to make good use of it.





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签