IOS development-multi-thread programming
1. "power saving, smoothness, high-quality applications, fast response, good user experience ......" It may be the Apple system in the eyes of many users.
2. In the age when mobile phone manufacturers struggled for CPU clock speed, 4-core and 8-core, Apple still insisted on dual-core, and the iphone user experience remained strong.
How to optimize IOS in the above two aspects, winning android in terms of endurance, smoothness and response speed, the answer is multithreading & RunLoop...
RunLoop is the core mechanism of IOS Event Response and task processing. It runs throughout the entire IOS system.
Unlike the general thread-loop waiting tasks, the traditional thread-loop waiting tasks will cause CPU time to be occupied. Although you have set the sleep time, many times there will be idling,
RunLoop is a monitoring event trigger processing mechanism. To put it bluntly, when there is an event, the CPU is fully produced. When no event is generated, the thread suspends the wait event.
It can be said that RunLoop is the main reason why IOS is more energy-efficient than android, smoother, and better user experience.
RunLoop also supports inter-thread communication and other mechanisms. The function is very powerful and practical. The editor has a little understanding of its peers and finds that its peers know RunLoop, but RunLoop is only a small part of it in actual development.
The following is a multi-threaded programming and RunLoop mind map. You can add a small Editor for the demo ..