There are a number of multithreading that will be as follows:
Multi-Thread Concept analysis
Multi-thread pthread, Nsthread, Nsoperation, GCD
Multi-Thread Nsthread
Multi-Thread Nsoperation
Multi-thread GCD
Pthread: Cross-platform, applicable to a variety of operating systems, portability, is a set of pure C language Common API, and the thread life cycle needs the programmer to manage their own, the use of more difficult, so in actual development is usually not used.
Nthread: It's an apple package for pthread. Through encapsulation, you can use multithreading more easily in a cocoa environment. The life cycle of a thread is managed by the programmer. Each Nsthread object corresponds to a thread that is really the most primitive thread.
1) Advantages: Nsthread lightweight minimum, relatively simple.
2) Cons: Manually manage some thread activity, such as lifecycle, thread synchronization, sleep, etc.
nsoperation : Based on the OC language API, the bottom layer is GCD, adding some more simple-to-use features, using more object-oriented. The life cycle of a thread is automatically managed by the system.
1) Advantages: Self-threading cycle management, the operation can pay more attention to their own logic.
2) Cons: Object-oriented abstract class, can only implement it or use it to define two sub-classes: Nsinvocationoperation and Nsblockoperation
GCD : ios4.0, based on the C language API, takes full advantage of the multi-core of the device and is designed to replace threading technology such as Nsthread. The life cycle of a thread is automatically managed by the system.
1) Advantages: maximum efficiency, avoid concurrency traps.
2) Cons: Based on C implementation.
Multi-thread pthread, Nsthread, Nsoperation, GCD