UI-GCD Threads

Source: Internet
Author: User
Tags gcd

First, what is the GCD full name is the Grand Central Dispatch, the pure C language writing, provides very many powerful function, is the current Apple official website recommended multithreading development method, Nsoperation is based on the GCD package two, the GCD superiority 1, for the multi-core parallel operation proposed The solution 2, GCD will automatically take advantage of more CPU cores, such as dual-core, quad-core 3, GCD can automatically manage the life cycle of threads (create threads, dispatch tasks, Destroy threads) 4, programmers only need to tell gcd what to do, do not write any thread management code three, GCD two core concepts 1, tasks: What to do 2, queue: To hold a task four, the queue can be divided into two major types: 1, serial queue: (Serial Dispatch Que)there can only be one thread, add the actions added to the queue by addingSequential execution sequentially, a task is completed before the next task 2, concurrent queue is executed: (Concurrent Dispatch queue)can have multiple threads, he will put these threads on the available processors, while ensuring advanced task Priority 3, there is a special queue is the home column, the main queue is always only one thread (the main thread), used to perform the main thread operation task Five, take gcd long thread, can be abstracted into two steps 1, find the queue {Home row or serial queue or parallel queue} 2, execute task in queue synchronously or asynchronously six, execute two forms of task in queue 1, synchronize: Only the current thread performs the task,does not haveAbility to open a new thread 2, async: You can perform tasks in a new thread,withAbility to open a new thread Vii. thread task created by GCD four ways to do 1, serial synchronization (main thread) 2, serial async (Child thread) 3, parallel synchronization (child thread) 4, parallel async (child thread)

UI-GCD Threads

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.