NSOperationQueue and concurrent vs non-concurrent NSOperationQueue and concurrent vs non-concurrent multithreading multithreading

NSOperationQueue and concurrent vs non-concurrent


NSOperationQueue always executes operations concurrently, while taking dependencies into account.

A "non-concurrent" operation requires a separate thread in order to execute concurrently. NSOperationQueue is responsible for providing this thread. In other words, a non-concurrent operation depends on NSOperationQueue to make it a concurrent operation.

A "concurrent" operation is concurrent on its own; it doesn't need NSOperationQueue to create a thread for it. An example would be an operation that uses asynchronous file IO.

If you want two or more operations to execute serially you need to use dependencies.

If you want an operation to block the main thread then don't use NSOperationQueue; just run each operation one after the other on the main thread.

To manually set maximum of concurrent operations, use method on operationQueue setMaxConcurrentOperationCount:


Do you really need to subclass NSOperation? Why not just use NSInvocationOperation and its addDependency: method?

See my answer in this SO question.