Explain the Grand Central Dispatch (GDC).
GCD (Grand Central Dispatch) is a low-level API for managing the concurrent operations. This concept is used to help in improving application performance. This process is used to manage multiple tasks at the same time. Grand Central Dispatch (GCD) is the most useful API for multitasking with Async and Sync programming in iOS.
- Dispatch Queue: The Dispatch Queue manages the task in FIFO(First In First Out) order. Dispatch queues are thread-safe as we can access them from multiple threads simultaneously.
- Concurrent: This process has started multiple tasks at the same time but is not sure of the termination at the same time. It can be finished in any order. They execute one or more tasks at the same time concurrently. The task is completed according to the complexity, and not by the order in the queue.
- Serial: Only one task will execute at a time. It can be used to synchronize access to a specific resource.
- Sync: A synchronous function has return control to the caller after the task is complete.
- Async: An asynchronous function returns immediately, by ordering the task to start but will not wait for it to complete.
