简体   繁体   中英

What is the concurrency limit for GCD Dispatch groups?

I've been using a DispatchGroup to facilitate a number of concurrent calls in my app.

My backend team noticed that when I tried to make eight concurrent calls, they were separated into two batches of four calls.

  1. Is four concurrent calls the limit for GCD?
  2. Is this a limitation of the GCD framework, or is this dependent on the hardware?
  3. Is there a way to allow for more concurrent calls?

From the reference for 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.

The system automatically (and dynamically) determines how many tasks to execute simultaneously. Among other things it's based on battery state, # of cores, system load, etc.

See Dispatch Queues for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM