A Brief Introduction to ios multi-thread GCD and ios multi-thread gcd
I haven't written a blog for a long time. I am too busy to write. Now I am idle. Today I will introduce you to the usage of GCD in ios development.
A beginner at the beginning may be confused about multithreading. What is thread? It's actually very simple. Don't think that complicated.
1. We usually know that a process is a program in progress. Each process has its own independent memory space and processes do not interfere with each other. (For example, if you open it)
2. What is a thread? A thread is the basic unit of process execution. Tasks in a process are executed in the thread. After the process is started, it is automatically merged into the Main thread (ios UI Main thread) and then executed.
3. for example, if I want to download three images (a-B-c), they will not download them in sequence, from a to B to c, just like queuing up teams to buy steamed buns, one by one.
4. What is multithreading? There can be multiple threads in a process. These threads can be executed at the same time. I don't want to queue up or wait too slowly. Of course, it is not polite to jump into the queue. Then we can use multiple threads to buy steamed buns, and then everyone can buy steamed buns instead of waiting in line.
5. Implementation principle of multithreading. Concurrent execution in multiple threads is achieved through cpu time rotation (simultaneous download through scheduling.
Next we will show you how to implement the Code in multiple threads.
Here is just a simple understanding for everyone. Next, I will spend a lot of space to detail the usage of multithreading. Haha, the first summary ends here.