employer cover photo
employer logo
employer logo

Tata Consultancy Services (North America)

Is this your company?

Tata Consultancy Services (North America) interview question

Whats the difference between Dispatch Queues and Operations Queues?

Interview Answer

Anonymous

22 May 2019

A Dispatch Queue is a feature of GCD (grand central dispatch) - GCD is an Apple framework built on top of threads, and can remove the need for us to direct our task to different thread, as we had to prior to release GCD. This is because, under the hood it manages a shared thread pool. With GCD you add blocks of code or work items to dispatch queues and GCD decides which thread to execute them on. This relates to the topic of Concurrency. Conversely, an OperationQueue is a task management feature from the Foundation framework. It a class that regulates the execution of Operations (where an `Operation` is an abstract class that represents the code and data associated with a single task). An operation queue executes its queued Operation objects based on their priority and readiness. After being added to an operation queue, an operation remains in its queue until it reports that it is finished with its task.

1