# Dispatch Execute code concurrently on multicore hardware by submitting work to dispatch queues managed by the system. ## Overview Dispatch, also known as Grand Central Dispatch (GCD), contains language features, runtime libraries, and system enhancements that provide systemic, comprehensive improvements to the support for concurrent code execution on multicore hardware in macOS, iOS, watchOS, and tvOS. The BSD subsystem, Core Foundation, and Cocoa APIs have all been extended to use these enhancements to help both the system and your application to run faster, more efficiently, and with improved responsiveness. Consider how difficult it is for a single application to use multiple cores effectively, let alone to do it on different computers with different numbers of computing cores or in an environment with multiple applications competing for those cores. GCD, operating at the system level, can better accommodate the needs of all running applications, matching them to the available system resources in a balanced fashion. ### Dispatch Objects and ARC When you build your app using the Objective-C compiler, all dispatch objects are Objective-C objects. As such, when automatic reference counting (ARC) is enabled, dispatch objects are retained and released automatically, just like any other Objective-C object. When ARC is not enabled, use the [`dispatch_retain`](/documentation/Dispatch/dispatch_retain) and [`dispatch_release`](/documentation/Dispatch/dispatch_release) functions (or Objective-C semantics) to retain and release your dispatch objects. You cannot use the Core Foundation retain and release functions. If you need to use retain and release semantics in an ARC-enabled app with a later deployment target (for maintaining compatibility with existing code), you can disable Objective-C-based dispatch objects by adding `-DOS_OBJECT_USE_OBJC=0` to your compiler flags. ## Topics ### Queues and Tasks [`DispatchQueue`](/documentation/Dispatch/DispatchQueue) An object that manages the execution of tasks serially or concurrently on your app’s main thread or on a background thread. [`DispatchWorkItem`](/documentation/Dispatch/DispatchWorkItem) The work you want to perform, encapsulated in a way that lets you attach a completion handle or execution dependencies. [`DispatchGroup`](/documentation/Dispatch/DispatchGroup) A group of tasks that you monitor as a single unit. [`dispatch_get_main_queue`](/documentation/Dispatch/dispatch_get_main_queue) Returns the serial dispatch queue associated with the application’s main thread. [`dispatch_get_global_queue`](/documentation/Dispatch/dispatch_get_global_queue) Returns a system-defined global concurrent queue with the specified quality-of-service class. [Dispatch Queue](/documentation/Dispatch/dispatch-queue) An object that manages the execution of tasks serially or concurrently on your app’s main thread or on a background thread. [Dispatch Work Item](/documentation/Dispatch/dispatch-work-item) The work you want to perform, encapsulated in a way that lets you attach a completion handle or execution dependencies. [Dispatch Group](/documentation/Dispatch/dispatch-group) A group of tasks that you monitor as a single unit. [Workloop](/documentation/Dispatch/workloop) A dispatch object that prioritizes the execution of tasks based on their quality-of-service (QoS) level. ### Thread Scheduling [`DispatchQoS`](/documentation/Dispatch/DispatchQoS) The quality of service, or the execution priority, to apply to tasks. [`dispatch_qos_class_t`](/documentation/Dispatch/dispatch_qos_class_t) Quality-of-service classes that specify the priorities for executing tasks. [`dispatch_queue_priority_t`](/documentation/Dispatch/dispatch_queue_priority_t) The execution priority for tasks in a global concurrent queue. [`dispatch_set_qos_class_floor`](/documentation/Dispatch/dispatch_set_qos_class_floor) Specifies the minimum quality-of-service level for a dispatch queue, source, or workloop. ### System Event Monitoring [`DispatchSource`](/documentation/Dispatch/DispatchSource) An object that coordinates the processing of specific low-level system events, such as file-system events, timers, and UNIX signals. [Dispatch Source](/documentation/Dispatch/dispatch-source) An object that coordinates the processing of specific low-level system events, such as file-system events, timers, and UNIX signals. [`DispatchIO`](/documentation/Dispatch/DispatchIO) An object that manages operations on a file descriptor using either stream-based or random-access semantics. [`DispatchData`](/documentation/Dispatch/DispatchData) An object that manages a memory-based data buffer and exposes it as a contiguous block of memory. [`DispatchDataIterator`](/documentation/Dispatch/DispatchDataIterator) A byte-by-byte iterator over the contents of a dispatch data object. [Dispatch I/O](/documentation/Dispatch/dispatch-i-o) An object that manages operations on a file descriptor using either stream-based or random-access semantics. [Dispatch Data](/documentation/Dispatch/dispatch-data) An object that manages a memory-based data buffer and exposes it as a contiguous block of memory. [`DispatchSourceProtocol`](/documentation/Dispatch/DispatchSourceProtocol) Defines a common set of properties and methods that are shared with all dispatch source types. ### Task Synchronization [`DispatchSemaphore`](/documentation/Dispatch/DispatchSemaphore) An object that controls access to a resource across multiple execution contexts through use of a traditional counting semaphore. [Dispatch Semaphore](/documentation/Dispatch/dispatch-semaphore) An object that controls access to a resource across multiple execution contexts through use of a traditional counting semaphore. [Dispatch Barrier](/documentation/Dispatch/dispatch-barrier) A synchronization point for tasks executing in a concurrent dispatch queue. ### Time Constructs [`DispatchTime`](/documentation/Dispatch/DispatchTime) A point in time relative to the default clock, with nanosecond precision. [`DispatchWallTime`](/documentation/Dispatch/DispatchWallTime) An absolute point in time according to the wall clock, with microsecond precision. [`DispatchTimeInterval`](/documentation/Dispatch/DispatchTimeInterval) A number of seconds, millisconds, microseconds, or nanoseconds. [`DispatchTimeoutResult`](/documentation/Dispatch/DispatchTimeoutResult) A result value indicating whether a dispatch operation finished before a specified time. [`dispatch_time`](/documentation/Dispatch/dispatch_time) Creates a `dispatch_time_t` relative to the default clock or modifies an existing `dispatch_time_t`. [`dispatch_walltime`](/documentation/Dispatch/dispatch_walltime) Creates a `dispatch_time_t` using an absolute time according to the wall clock. [`dispatch_time_t`](/documentation/Dispatch/dispatch_time_t) An abstract representation of time. [`DISPATCH_WALLTIME_NOW`](/documentation/Dispatch/DISPATCH_WALLTIME_NOW) The current time. [Wall Time Constants](/documentation/Dispatch/2963138-wall-time-constants) Constants for wall time values. ### Dispatch Objects [`DispatchObject`](/documentation/Dispatch/DispatchObject) The base class for most dispatch types. [`DispatchPredicate`](/documentation/Dispatch/DispatchPredicate) Logical conditions to evaluate within a given execution context. [`dispatchPrecondition(condition:)`](/documentation/Dispatch/dispatchPrecondition(condition:)) Checks a dispatch condition necessary for further execution. [Dispatch Objects](/documentation/Dispatch/dispatch-objects) The basic behaviors supported by all dispatch types. ### Deprecated [Deprecated Symbols](/documentation/Dispatch/deprecated-symbols) ### Classes [`DispatchWorkloop`](/documentation/Dispatch/DispatchWorkloop) ### Protocols [`OS_dispatch_queue_serial_executor`](/documentation/Dispatch/OS_dispatch_queue_serial_executor) ### Reference [Dispatch Constants](/documentation/Dispatch/dispatch-constants) [Dispatch Data Types](/documentation/Dispatch/dispatch-data-types) [Dispatch Functions](/documentation/Dispatch/dispatch-functions) --- Copyright © 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)