iOS Learning--Multithreading and GCD understanding

Source: Internet
Author: User

the concept of a process : Each process is an application, has a separate memory space, in general, an application exists a process, but there are multiple processes (such as the browser)

Threads in the same process share memory and resources in memory.

Multi-Threading concept: Each program has a main thread that invokes the main function to start

The main thread's life cycle is bound to the application, and the main thread stops when the program exits.

Multithreading technology indicates that using multithreading can increase CPU utilization and prevent the main line from being blocked.

Any task that is likely to clog the main line is not placed on the mainline call execution ( access network )

Note: The use of threads is not uncontrolled, only the main line is called the ability to directly modify the UI


Advantages and disadvantages of iOS three multithreading technologies:

1.NSThread:

Pros:nsthread than the other two lightweight, easy to use

Disadvantages : You need to manage your thread's lifecycle, thread synchronization, locking, sleep, and wake up. Thread synchronization has some overhead in locking the data


2.NSOperation:

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

Nsoperation is an object-oriented


3.GCD

The Grand Central Dispatch is a multi-core programming solution developed by Apple. Ios4.0+ is an efficient and powerful technology that replaces Nsthread, Nsoperation

GCD is based on the C language











iOS Learning--Multithreading and GCD understanding

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.