I replied to a post last night. The content is classic. So I 'd like to open a post for you to study!
It mainly includes two System Performance Parameters in the machine:
1. Debug. SF. hW = 0 and change to debug. SF. hW = 1. This step enables hardware acceleration.
2. Modify Dalvik. VM. heapsize = 24 m to Dalvik. VM. heapsize = 32 m. In this step, set the Virtual Machine size to 32 m.
Note that this is to modify the VM memory, not the virtual memory !! These two are completely different!
Recent
Forum
The post about modifying two parameters of the Android system is very popular.
Mobile phone
Performance. After the modification, the author said that it was useful, and that it was not easy to use. The author was regarded as a God. If it was not easy to use, the author was half-dead. In fact, it is scientific, and there are always advantages and disadvantages, as long as we analyze the changes, we can find out why we want to change and what benefits can we get after the changes. Holding others as God or stepping on others as mud is not good for the development of things.
The modification mainly involves modifying two parameters:
Debug. SF. hW = 0 and change to debug. SF. hW = 1. This step enables hardware acceleration.
Dalvik. VM. heapsize = 24 m, changed to Dalvik. VM. heapsize = 32 m, this step is to modify the Virtual Machine size to 32 m
Let me explain to you what the two parameters are for, and tell you why I didn't modify the two parameters when I made the Rom.
1. Dalvik. VM. heapsize = 24 m, changed to Dalvik. VM. heapsize = 32 m, this step is to modify the Virtual Machine size to 32 m
Android is actually a java system built on the Linux kernel. Students familiar with Java should know that when running Java programs, they need to create a virtual machine in each program, in order to obtain the memory allocation, the advantage is that if a program crashes, the system only needs to shut down the Virtual Machine and will not affect other programs. The disadvantage is that memory consumption is very high, because each time you open a program, a new virtual machine is required.
For example, when program a is enabled, program a automatically requests a VM memory from the system, and then runs another program B without closing the VM memory, program B requests three copies of memory from the system. If the VM memory is set to 24 MB, the two programs occupy 1x24 + 3x24 = 96 MB of memory. Assuming that the VM memory is set to 32 m, the two programs occupy 1x32 + 3x32 = 128 m in total.
So, are you sure you want to modify it?
Assume that only some small programs, such as QQ and reading
Software
Small
Games
And so on, we recommend that you do not modify the standard 24 m, because it is enough, and to prevent too many running programs from crashing. Is the smaller the better? Of course not, because the memory allocated to the program is too small, it may be because the software does not have enough memory to run smoothly.
It is assumed that large programs, such as large 3D games, are often run, can be slightly larger to make large programs run with enough memory, which can be smoother. The bigger the program, the better. Of course not. Because the tune is too large, other programs will not be allocated memory and will not be able to run.
Why should Google set the system's Virtual Machine to 24 m? Because some software eats memory, and some small software does not eat memory, I think this is a moderate design, because it cannot be all biased towards large, and it cannot be all biased towards small, that's moderate.
We all know that the host ram of Huawei c8650 is 256 MB, which is fixed. We can decide whether to use 24 m or 32 m for a virtual machine. However, for some program control, we recommend that you do not change the number of packages that need to enable the Service on your mobile phone. Otherwise, you need to start a large number of programs when starting the service, and you will not be able to enable the host.
Let's compare it with common Windows systems. Suppose there is also MB of memory.
The memory mechanism of Windows is as follows: a program comes, and the program tells the system that I want 100 MB, and then the second program comes. The second program says, I want 150 mb. At this time, the memory has been used 100 m + 150 m = 250 m, and the remaining 6 m.
Then we came to the third program, and the third program said, "I want 50 m. The system crashes because it is not enough for him.
The memory mechanism of Android is as follows: a program comes, and the program tells the system that I want 100 MB, and then the second program comes. The second program says, "I want 150 mb. At this time, the memory has been used 100 m + 150 m = 250 m, and the remaining 6 m.
Then we came to the third program, and the third program said, "I want 50 M. At this time, the system will automatically shut down the virtual machine that first applied for the memory program, or the virtual machine of the most secondary program, he shut down the first program, and the system got 106 MB of memory. With the remaining 6 m, the total memory was MB, and allocated to the third program 50 m, the system continued to run.
The first one is the three monks who don't have water to eat.
The second is to sacrifice the ego and complete the big self.
Of course, the system is much more complex than above in actual use. For example, Android also adds a "hidden mechanism", and all programs that do not run will automatically release the memory immediately, in Windows, when three programs grab the memory, they also add the "Wait Mechanism" and so on. If you are interested, you can study it on your own.
Repost an article on the hiapk Forum: "How Android works... don't worry about memory size" (all of the following are reprinted)
Do not care about the remaining memory size.
In fact, many people bring the habit of using other systems.
Android
Most applications do not exit the design, which is related to the process scheduling mechanism of the system. If you know Java, you can better understand this mechanism. In fact, similar to Java's garbage collection mechanism, the system has a rule to recycle memory. There is a threshold value for memory scheduling. Only systems below this threshold value will close things that are not needed by a single list. Of course, this value is set very small by default, so you will see that the memory is always at a very small number. But in fact, it does not affect the speed. On the contrary, it accelerates the next application startup. This is one of the advantages advertised by Android. It is not necessary to manually close the process. In particular, software that automatically disables processes.
Some may say here, why is it slow to run large programs when there is little memory? In fact, it is very simple to open a large program when there is not much memory left, it will trigger the system's own process scheduling policy, which is a very expensive operation of system resources, especially when a program frequently requests memory from the system. In this case, the system does not shut down all open processes, but closes them selectively. frequent scheduling will naturally slow down the system. Therefore, there is a program on the forum that can change the memory threshold value to some extent.
However, changes may also cause problems, depending on the value setting.
Is process management software necessary? Yes. Before running a large program, you can manually close some processes to release the memory, which can significantly improve the running speed. However, some small programs can be managed by the system itself. Speaking of this, there may be
Friend
I will ask if it will consume more power if the program is not closed. Let me talk about the principles of the android background and you will understand it. When the Android app is switched to the background, it is actually suspended and does not consume CPU resources, but only keeps running. So why does some programs switch out and re-enter the main interface. However, if a program wants to process something in the background, such
Music
Play, it will enable a service. Services can continue to run in the background, so only applications with services consume power in the background. This can be seen in the process management software. The label is service. I will not talk about broadcasting or anything. Therefore, applications without services have no power consumption in the background, and there is no need to disable them. This design is a very good design. It will be faster when you start the program next time. Because you do not need to read interface resources, why should you disable them to erase the advantages of Android? There is another one. Why does an Android app seem to consume so much memory. As you know, applications on Android are Java, and virtual machines are required. Applications on Android have independent virtual machines, that is, each application opens an independent virtual machine. The reason for this design is that the failure of the virtual machine can avoid the entire system crash, but the cost is that more memory is needed.
The above design ensures the stability of Android. Under normal circumstances, a single program may crash at most, but the entire system will not crash and there will never be any prompts of insufficient memory. You may be poisoned too deeply by windows and always want to keep more memory, but in fact this does not necessarily increase the speed. On the contrary, it has lost the system feature of fast program startup, it is unnecessary. You may wish to use this system as I said. Finally, we recommend a process management software, which can be found on systempanel and market. The interface is easy to start and has good functions and is used to manually close the process.
I wish you a good time playing with the computer. This system has been running for ten days and a half months, but it is not windows.
Original post address:
Http://www.betalive.cn/wordpress? P = 121
The above content is post. As to why switching slows down after a large program or several programs are enabled, my understanding is as follows:
1. large program a has been enabled and occupies 70% of the memory. If you want to run another program B and need 50% of the memory, you need to release or compress a from the memory, so it is shown to be slow for a while.
2. A \ B \ c \ D \ e occupies a total of 80% of the memory. Running the new program Z requires 20% of the memory, because the system memory has never seen the remaining 0, that is, there should be a part of idle memory, then we need ~ E. Select one or more of these programs to close. This process also consumes system resources, so it will take a while.
3. That is to say, when you manually kill the program, the system is releasing the memory for the system. Even if you do not kill the system, the system will automatically release the memory when you need it.
4. programs that are not running in the background (No Service) will not consume power even if they are not killed. Programs running in the background (with services), such as playing songs in the background, will certainly consume power.
5. It doesn't mean that killing processes is useless. Otherwise, the author won't recommend process management software. Which of the following services consumes power? the backend is always running. You can see the services, so you should kill them.
6. Take QQ as an example. If you exit normally, the running status of QQ will be left in process management, but the CPU will not be consumed. If you just switch out (press a small house instead of exiting) it will naturally consume power, because the program is still running.
The second parameter is Debug. SF. hW = 0 and changed to debug. SF. hW = 1. This step enables hardware acceleration.
First of all, I would like to explain that there is no free lunch in this world. If we can improve the performance through simple settings, why not do it? We can see that this tool has limited utility or needs to be used with other tools!
So far, there has not been a standard saying about the role of this setting. Why is it used to enable hardware acceleration? What hardware acceleration is enabled?
Is it 3D performance? Is there no 3D performance if it is not enabled?
Enable some special CPU performance? This is also unreliable! Obtain the CPU performance depends on the instruction set! What's more, why don't I start using it?
Enable other hardware performance? Have you changed the speaker to loud? But can a 30 W pixel camera take W? Has the memory changed from 512 MB to MB?
Or is it to keep the CPU 100% performance? In this way, the performance is improved, but the battery performance is reduced! (I think this explanation is a little more reliable)
I personally think that the purpose of this setting is to enable or end the optimization commands of the hardware vendor. Because each vendor has different hardware settings, an optimization command must be set in some locations, and enable it through this setting.
For example, in Google's engineering design standards, the mobile phone setting standard for a certain version is M memory, and all mobile phone manufacturers are told: if you follow my standards, so debug. SF. hW = is set to 0. If you want to change some hardware settings, set it to 1, but after setting it to 1, you have to point to a file, tell the system what has been modified. A mobile phone manufacturer increases the memory to 512 MB for faster mobile phones, and sets a file to tell the system that the mobile phone uses 256 MB of memory instead of MB.
Then someone started using a cell phone with optimization instructions. After a while
Time
After changing the new mobile phone, I found that the configuration was similar, but the performance was not the same. So I found this command by comparing the files on the original mobile phone, So I modified it and told others with great interest, but in fact, his new mobile phone did not set the optimization command. After it was turned on, it was not turned on. Even because the system could not find the optimization command, but the settings told him that there was an optimization command, the system is also overwhelmed, and the operation is slower, or there is a problem ........
However, the "New Discoveries" of this person make this simple 0 and 1 a legend of the generation (or a rumor of the generation)
Note: The red part is only for personal guesses.
Due to limited information, I may have some mistakes. please correct me.
Some people say that all the self-made rom has changed these two parameters. In fact, at least my rom has never changed. If you are interested, you can use my Rom to study it.
Rom address:
Http://bbs.apkok.com/thread-141669-1-1.html