About IOS multitasking and Memory Management

Source: Internet
Author: User

I. I have read a lot of questions about whether FY is working on its available memory of MB or MB. I have to worry about how to optimize the available memory.
In iOS, task management and memory management are very different from those in windows. Many FY are used to thinking about iOS in windows. Windows users all know that the more windows open, the slower the system. Why? Because all windows are running, the CPU usage is high, and all windows occupy the memory. Insufficient available memory also forces the system to use the hard disk as the virtual memory. Frequent read/write of the hard disk will certainly consume more power, and the hard disk speed is also slow.
IOS is different. First, except for a few background tasks (such as playing music), most background tasks are suspended. For example, if you want to switch to the backend, the motor will not sound. After you switch back, you have to click "continue" to continue running. This type of software makes it meaningless to continue running in the background except for increasing power consumption. You do not want the race car to continue hitting when it is switched to the backend, do you?
Since the software is suspended in the background, of course, it will not occupy the CPU, and will not consume power. The software is suspended in the background and does not occupy the CPU, but should the total memory be occupied? Will it consume much of the memory? Will it slow down the system?
? The answer is still: No.
IOS does not prepare virtual memory for IPA. If the front-end Software Memory is insufficient, IOS will directly release the memory occupied by the background software, and will not use the hard disk virtual memory like Windows (resulting in increased power consumption ). Releasing a piece of memory is very easy. It is just to change the memory block identifier from "occupied" to "idle". The memory content is discarded directly without being exchanged to the flash memory, which is very fast. (This is similar to deleting a file. It only indicates the deletion of the file name and does not delete the file content. In this way, you can delete a file of several GB, it is as fast as deleting a file of several K)
We can see that the windows experience is not applicable to IOS.
The memory for which software is released in the background is also exquisite. Some background software may have serious consequences after it is released, such as the game software. After it is released, the software ends. Switching back is equivalent to restarting and the game progress is lost.
Some software is irrelevant. For example, in the e-book software, after the reserved memory is released, the software can retain only one bookmarks. After switching back, the software can reload the content and continue reading. For example, the memory occupied by the sarafi browser is released. Switching back is nothing more than page re-loading, which will not cause serious consequences. IOS releases background software that is not memory-insensitive.
For software that has been switched to the backend, neither occupying the CPU nor memory is released, in fact, the software has ended, and such background software is even less energy-consuming. Double-click the back-end task list shown in home, most of which are such software.
If so, it means that IOS can open software without having to stop it. In fact, IOS software does not even have exit functions, so some FY complained that Apple IOS design is not user-friendly at all? To exit a software application, You have to double-click home, and then press the icon below for a long time. After the icon jitters, you can press the cross. In fact, I can see what I mentioned above. IOS software does not need to exit.
In fact, the objective of Apple's iOS multitasking design is to let you forget the existence of multitasking, such as IOS 3. X uses multiple tasks like a single task. If you want to run a software, you can run it. If you don't want to run it, you can press home directly, no matter how many software is opened in the background, the front-end software will not be slowed down (this is the case, the backend is suspended and does not occupy the CPU ). This is hard to imagine for windows, but apple did. Windows is not incompetent, but because Windows is used for work and requires all-around multitasking. iOS is just a mobile phone operating system with different emphasis.
Ii. Some FY have doubts about the same power consumption of IOS memory at no-load and full-load. They think: no-load memory power saving and high power consumption at full load. 
This is wrong. The so-called no-load and full load are for the operating system. For memory chip circuits, only 0 and 1 are seen. Even idle memory units have 0 and 1 in it. It must faithfully store all data, iPhone 4 has MB of memory. As long as it is turned on, the chip must keep powering on to save MB of data. It is impossible for the operating system to think that there is idle memory, it will cut off the power of those idle memory units to save power. Take a computer as an example. If you have two memory disks, You have to power them all when you open the computer. No, because you have a lot of idle memory, the motherboard will power off one of the memory, and then re-power it because the system needs more memory space.
Considering that full memory will increase power consumption, it is still the inertial thinking of windows. Again: in windows, when the memory is fully loaded, the system uses the hard disk as the virtual memory, so the power consumption increases and the speed slows down. IOS does not use the hard disk as the virtual memory, instead, the memory occupied by some background software is directly released until the memory is allocated.
Therefore, there is no difference in the power consumption for iOS when the memory is no-load or full-load. Because the memory is directly released when it is released, its content is directly discarded and does not need to be saved to the hard disk (which is different from that in Windows). Therefore, there is no difference in the speed between no-load memory and full load for IOS.

Iii. Part of FY is based on the obvious difference in power consumption when the backend is disabled.

In this regard, I will talk about it again: some people on the Forum shut down all the backend, closed the notifications, and even started the flight mode. In one night, no more than 10% of the power is available. Think twice about it. Some people don't know anything, and no matter what they do, dummies are dumb, one night is still 100% of the power.
Power Consumption problems vary from person to person and cannot be generalized. As far as I am concerned, I only enable 2G signal standby and enable notifications. I intentionally leave a few large games in the background without shutting down, and drop 1% at night. In fact, when you switch back to the background game, all the games will be paused. You must click resume on the screen to continue. The fact is that the game is paused in the background. If a fully paused background task can still enable it to continue running without any effort, you are too small to look at Apple's system designer.
Look at the plant war botnets game, switch back to the background and then switch back to the screen. Do you see the words "Game paused? The game is completely suspended in the background. It is not until you click resume. All games that support native backend are like this.
Let's take a look at Apple's authoritative explanation. If your foreign language is still compatible, you should be able to understand:
Http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
Executing code in the background
Most applications that enter the background state are moved to the susponded state shortly thereafter. while in this state, the application does not execute any code and may be removed from memory at any time. applications that provide specific services to the user can request background execution time in order to provide those services.
(Translated by myself): Most applications entering the background will soon become suspended. In this state, the application does not execute any code and may be removed from the memory at any time. (The translation is not followed)
After reading Apple's official explanation, do you have any questions about the background software's continued power consumption and memory usage? A background software that may be deprived of running memory at any time. What can it continue to occupy CPU and continue to consume power?

4. Is background management totally redundant?

Of course not. Some software that can run in the background, such as IPOD music playback, if you put it in the background and set the volume to a minimum, then it will continue to consume power and won't attract your attention (or there is no trace at all, at least there is a triangle playing icon on the top of the status bar ).
There are also some old software that does not support ios3.x in the background. After the background is changed to support the background, it may also run quietly in the background. In this case, background management is also required. The above two points are part of the supplement of FY in the reply. Thank you for your reference.

Http://bbs.weiphone.com/read-htm-tid-1905615.html

By gqzhu

Related Article

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.