Haven't written a blog for a long time, really too busy, no time to write. Now finally idle down, today will introduce you to iOS development in the use of GCD.
Beginners to start learning, perhaps the multi-threading is very confused, then what is a thread it? It's really simple, don't think so complicated.
1. We usually know the process, that is, the program in progress, each process has its own independent memory space, the process does not interfere with each other. (Just like you open it)
2. What is a thread? A thread is a basic unit of process execution. The tasks in the process are performed in a thread, and the process is automatically degenerated to the main thread (iOS UI Main thread) after it is started, and then the task is executed.
3. Threaded execution of threads, such as I want to download three pictures (a-b-c), they will not be carried out at the same time but in order to download, from A to B to C, like a line to buy steamed bread, one by one.
4. What is multithreading? There can be multiple threads in a process that can be executed at the same time, and I don't want to queue up or queue up, too slow. Then of course it is impolite to cut the queue. Then you can use multi-threaded to buy steamed bread, and then everyone can buy their own steamed bread without queuing.
5. The implementation principle of multithreading. Concurrent execution in multi-threading is achieved by the CPU's time rotation (through scheduling mechanism, simultaneous download).
Next we show you the implementation of the code in multi-threading.
Here is just to give you a simple understanding, then I will spend a few large space for you to detail the use of multi-threading. Haha, this is the end of the first summary.
A brief introduction to iOS multithreaded GCD