Grand Central Dispatch(GCD)-Part 1

  • Main queues: those queues run on the main thread and are serial queues. This is useful to update the UI after a task is done.
  • Global Queues: those are shared by the whole system, they are concurrent queues. This is useful for non UI tasks in background.
  • Custom Queues: can be either serial or concurrent, the developer can create them. This is useful for serial background work.

Global queues consists of 4 queues each with different priorities:

  • High.
  • Default.
  • low.
  • Background(lowest priority).

QoS consist of 4 classes:

  • User interactive: This must run on the main thread, use it for small UI updates or handling small workloads in order to have a great user experience. Tasks here must end immediately.
  • User initial: Use this when a user starts a task from the UI, and he’s waiting for fast results , and for tasks that are required to continue UI
  • Utility: This is used for long running tasks , like API calls.
  • Background: Use this for any work the user is not aware of. like prefetching data, or any work that doesn’t require any user interaction and tasks not related to time condition.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ali Jaber

Ali Jaber


iOS Engineer with more than 3 years experience in developing mobile apps in both swift and objective C for both local and international customers