Synchronous and asynchronous
Async: Refers to multithreading, the ' corresponding code ' is put in other threads to execute, the current thread of the code will continue to execute, do not need to wait until the code is placed in the child thread execution completed.
Synchronous execution function: This actual application scenario is not many, understand can
Login, registration needs to be placed in a queue to execute
The download file needs to be placed in a different queue to execute
Execute functions asynchronously:
Serial Queue features: If you want to turn on a thread, only one thread is turned on
(When the synchronization function executes, if the queue is a serial queue, no threads need to be opened and the task executes in the current thread)
(When an asynchronous function executes, if the queue is a serial queue, the thread can be turned on and only one thread will be opened)
Concurrent Queue Features: Multiple threads can be opened, iOS8 the number of previously open threads is limited. You can open many threads later.
(When the synchronization function executes, if the queue is a concurrent queue, no threads need to be opened and the task executes in the current thread)
(When an asynchronous function executes, if the queue is a concurrent queue, the thread can be turned on and multiple threads can be opened)
When the execution function and the queue are used in combination: * * * does not open threads and queues are not related, only by the execution function decision.
Several threads are determined by the queue and are not related to the execution function (serial, one-----concurrent, multiple).
Global queue: A concurrent queue that the system provides to us
Main queue: Placing a task in the main queue represents the code in the main thread to execute the task
-----------------------
Attention:
Dispatch_after This function executes the task asynchronously regardless of what the queue is
If the execution queue is the home column, the execution function does not open the new thread
The relationship between synchronous, asynchronous, and queue in iOS multi-threading