iOS multithreaded programming

Source: Internet
Author: User

1, Introduction:1.1 iOS has three multithreaded programming techniques, namely:

1., Nsthread

2, Cocoa nsoperation

3. GCD Full Name: Grand Central Dispatch

These three ways of programming from top to bottom, the level of abstraction from low to high, the higher the abstraction of the more simple to use, is also the most recommended for Apple.

1.2 Three ways of having disadvantages are introduced:

Nsthread

Pros: Nsthread than the other two lightweight

Cons: You need to manage your thread's life cycle, thread synchronization. Thread synchronization has a certain overhead in locking data

Cocoa operation

Pros: No need to care about thread management, data synchronization, you can focus on what you need to do.

Cocoa operation related classes are nsoperation, Nsoperationqueue. Nsoperation is an abstract class that uses its subclasses to implement it or to use the two subclasses it defines: Nsinvocationoperation and nsblockoperation. Creates an object of the Nsoperation subclass and adds the object to the Nsoperationqueue queue for execution.

GCD

Grand Central Dispatch (GCD) is a solution for multi-core programming developed by Apple. Can only be used after the iOS4.0 has started. GCD is an efficient and powerful alternative to technologies such as Nsthread, Nsoperationqueue, and Nsinvocationoperation. Now the iOS system has been upgraded to 6, so don't worry about the technology being used.


Evening Update ...


iOS multithreaded programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.