gpt4 book ai didi

ios - GCD Dispatch 组的并发限制是多少?

转载 作者:搜寻专家 更新时间:2023-11-01 06:00:43 25 4
gpt4 key购买 nike

我一直在使用 DispatchGroup 来促进我的应用程序中的多个并发调用。

我的后端团队注意到,当我尝试进行八个并发调用时,它们被分成两批,每批四个调用。

  1. 四个并发调用是 GCD 的限制吗?
  2. 这是 GCD 框架的限制,还是取决于硬件?
  3. 有没有办法允许更多的并发调用?

最佳答案

来自 GCD 的引用:

Concurrent queues (also known as a type of global dispatch queue) execute one or more tasks concurrently, but tasks are still started in the order in which they were added to the queue. The currently executing tasks run on distinct threads that are managed by the dispatch queue. The exact number of tasks executing at any given point is variable and depends on system conditions.

系统自动(动态)确定同时执行多少任务。除其他外,它还基于电池状态、内核数量、系统负载等。

参见 Dispatch Queues获取更多信息。

关于ios - GCD Dispatch 组的并发限制是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52103078/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com