PPCGeeks Forums HTC Arrive HTC HD2 HTC Thunderbolt HTC Touch Pro 2 HTC Evo 4G HTC Evo 3D Samsung Galaxy S II Motorola Droid X Apple iPhone Blackberry
Go Back   PPCGeeks > Android > General Android Discussion
Register Community Search

Notices


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-12-2010, 02:24 AM
bradart's Avatar
Officer Android
Offline
Pocket PC: HTC Hero, T-Mobile G1, Diamond, HTC Evo
Carrier: Sprint
Location: Right behind you.
 
Join Date: Jan 2009
Posts: 1,895
Reputation: 2614
bradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIPbradart is a VIP
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via AIM to bradart Send a message via MSN to bradart Send a message via Skype™ to bradart
[Please, for the love of god sticky this] Task killers and why you shouldn't use them

I'm kind of getting tired of explaining this to people.

Taken from here: http://geekfor.me/faq/you-shouldnt-b...-with-android/

Quote:
I see this come up over and over again. People saying that a task is running in the background and they think it is killing their battery or hogging all of their memory. So their natural reaction is to download a program made to kill tasks. Here’s the thing… you are likely doing more harm than good by killing tasks that aren’t ready to end. I was the same way when I first got my CDMA Hero. There were tons of things running that I didn’t want so I just kept killing them. After a few weeks I realized that if I stopped using a task killer (and totally uninstalled it in fact) my phone actually began to run better! The applications would close themselves and things just seemed to be running better. I get that there may be short term benefits from clearing a task, but you should still take the time to read through this.


Here is some information directly from Android’s developer page. I have put the important parts in bold. This is quite a lengthy read but honestly I think it’s important. If you want the full read then you can check out the dev page here. If you just want the quick TL;DNR version then scroll to the bottom.

By default, every application runs in its own Linux process. Android starts the process when any of the application’s code needs to be executed, and shuts down the process when it’s no longer needed and system resources are required by other applications.

A content provider is active only while it’s responding to a request from a ContentResolver. And a broadcast receiver is active only while it’s responding to a broadcast message. So there’s no need to explicitly shut down these components.

Activities, on the other hand, provide the user interface. They’re in a long-running conversation with the user and may remain active, even when idle, as long as the conversation continues. Similarly, services may also remain running for a long time. So Android has methods to shut down activities and services in an orderly way:

An activity can be shut down by calling its finish() method. One activity can shut down another activity (one it started with startActivityForResult()) by calling finishActivity().
A service can be stopped by calling its stopSelf() method, or by calling Context.stopService().
Components might also be shut down by the system when they are no longer being used or when Android must reclaim memory for more active components.

If the user leaves a task for a long time, the system clears the task of all activities except the root activity. When the user returns to the task again, it’s as the user left it, except that only the initial activity is present. The idea is that, after a time, users will likely have abandoned what they were doing before and are returning to the task to begin something new.

Activity lifecycle
An activity has essentially three states:

It is active or running when it is in the foreground of the screen (at the top of the activity stack for the current task). This is the activity that is the focus for the user’s actions.
It is paused if it has lost focus but is still visible to the user. That is, another activity lies on top of it and that activity either is transparent or doesn’t cover the full screen, so some of the paused activity can show through. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.
It is stopped if it is completely obscured by another activity. It still retains all state and member information. However, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.
If an activity is paused or stopped, the system can drop it from memory either by asking it to finish (calling its finish() method), or simply killing its process. When it is displayed again to the user, it must be completely restarted and restored to its previous state.

The foreground lifetime of an activity happens between a call to onResume() until a corresponding call to onPause(). During this time, the activity is in front of all other activities on screen and is interacting with the user. An activity can frequently transition between the resumed and paused states — for example, onPause() is called when the device goes to sleep or when a new activity is started, onResume() is called when an activity result or a new intent is delivered. Therefore, the code in these two methods should be fairly lightweight.

The following diagram illustrates these loops and the paths an activity may take between states. The colored ovals are major states the activity can be in. The square rectangles represent the callback methods you can implement to perform operations when the activity transitions between states.



So… the TL;DNR Version:
Android is hard coded to automatically kill a task when more memory is needed.
Android is hard coded to automatically kill a task when it’s done doing what it needs to do.
Android is hard coded to automatically kill a task when you haven’t returned to it in a long time.
Most services (while possibly running in the background) use very little memory when not actively doing something.
A content provider is only doing something when there is a notification for it to give. Otherwise it uses very little memory.
Killing a process when it isn’t ready only causes it to have to reload itself and start from scratch when it’s needed again.
Because a task is likely running in the background for a reason, killing it will only cause it to re-spawn as soon as the activity that was using it looks for it again. And it will just have to start over again.
Killing certain processes can have undesirable side effects. Not receiving text messages, alarms not going off, and force closes just to name a few.
The only true way to prevent something from running at all on your phone would be to uninstall the .apk.
Most applications will exit themselves if you get out of it by hitting “back” until it closes rather than hitting the “home” button. But even with hitting home, Android will eventually kill it once it’s been in the background for a while.
Questions? Concerns? Feel that I’m wrong? Comment below and let’s discuss!

Addendum:
One thing that I forgot to even address here is that memory works a bit differently in linux than it does in Windows. In general the way memory works is you really only need as much as you plan on using. So if your combined running programs use 100mb of memory, 150mb is more than enough. There is no need to clear what’s running in memory before you hit that 150mb cap. Now in Windows it seems that the system performs a bit better when you have less stuff in memory, even if it’s not full. No doubt those who have been on computers for a while will remember there used to be programs that could clear your memory in Windows also.

Linux however isn’t generally affected by this. While I admit that I don’t know the architecture and reason for this… linux will run the same regardless of if you have 20mb free memory or 200mb. And as I outlined above, Android will automatically start to kill applications if you do get low on memory! Stealing a quote from Chris Johnston, “Buffers and cache in RAM being cleared is silly. Imagine a professor, who rather than writing all the way across the chalkboard, finishes a sentence and immediately erases and starts writing in the upper left corner AGAIN and AGAIN and AGAIN OR imagine you like a song. You record it to the beginning of a cassette tape. When you want a new song, do you re-record over the first song or record after it?”

I have also seen people incorrectly assume that the more memory in use, the faster their battery will die. This would actually be more attributed to the amount of processor cycles (CPU %) going on and not the amount of memory being taken up by a certain program. However, that does lead to a good point! When can a task manager be a good thing?? To help you determine what IS slowing down your phone; what may actually be draining your battery faster. That is actually what helped us discover that there appears to be a bug still left over from 1.5 that is causing slow downs on our CDMA Hero’s even today. While an item using up memory isn’t going to hurt things, an item chewing through your CPU absolutely will. Now I still don’t suggest using a task killer to kill a program that is using up your processor (unless of course it is a zombie process that is going crazy, but you should probably just reboot in that case). But it can help you see what’s going on with your phone.

I hope this has helped someone. With all of that said… I always encourage experimenting. It is your phone, and you can do with it what you please. If you swear that a task killer makes your phone amazing, then by all means use it! Thanks for reading.
__________________
Olympic-class smoker since 2005.

Sponsored by Kools.

Last edited by bradart; 10-12-2010 at 02:27 AM.
Reply With Quote
This post has been thanked 3 times.
  #2 (permalink)  
Old 10-12-2010, 03:36 AM
themuffinman's Avatar
Shop smart, shop S-MART!!
Offline
Pocket PC: Evolte, Gnex
Carrier: Sprint
Location: Jonesboro Ga
 
Join Date: Dec 2006
Posts: 2,387
Reputation: 2615
themuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIPthemuffinman is a VIP
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

This is one of these topics where the opinion is gonna vary. Regardless of what you post you gonna have some people that will swear by it anyway.
__________________
"THE HTC EVO LTE..........YES, IT'S A BEAST AND A HALF"


Reply With Quote
  #3 (permalink)  
Old 10-12-2010, 08:32 AM
chas123's Avatar
Halfway to VIP Status
Offline
Pocket PC: EVO
Carrier: Sprint
Location: Virginia
 
Join Date: Oct 2008
Posts: 509
Reputation: 1030
chas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on repchas123 is halfway to VIP status based on rep
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

You should go to the page referenced in the link and read the comments. There are some coders chime who feel differently. I can see some of the system processes needing to run in the background, but when I leave something like say Holdem Poker it really ought to shut down. I agree whole heartedly with the comment that devs need to include an exit option in the apps that they turn out. I am new to android, understand the concepts in the original article, but someone is still going to have to sell me on why having a bunch of useless crap loaded into memory all the time doesn't adversely affect battery life.
Reply With Quote
  #4 (permalink)  
Old 10-12-2010, 10:12 AM
neudof's Avatar
Halfway to VIP Status
Offline
Pocket PC: Samsung Galaxy Note 2
Carrier: Sprint Advantage Club
Location: MN
 
Join Date: Nov 2008
Posts: 654
Reputation: 1830
neudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on repneudof is halfway to VIP status based on rep
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

time for somebody to create a long press X application like Windows mobile has....
__________________
2GB of free online storage accessable from any device with Dropbox: http://db.tt/DhSdics
Please click "Thanks" if I have helped or inspired you.
Reply With Quote
  #5 (permalink)  
Old 10-12-2010, 10:27 AM
w7excursion's Avatar
truth mirror
Offline
Pocket PC: N Deuce
Carrier: Sprint
Location: Livin On A Prayer
 
Join Date: Sep 2007
Posts: 1,461
Reputation: 980
w7excursion knows their stuffw7excursion knows their stuffw7excursion knows their stuffw7excursion knows their stuffw7excursion knows their stuffw7excursion knows their stuffw7excursion knows their stuffw7excursion knows their stuff
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

I use one and it works awesome. I wish I had one for real life use lol.
__________________
Kiss my grits
Reply With Quote
  #6 (permalink)  
Old 10-12-2010, 10:52 AM
orangekid's Avatar
Awesomenss :)
Offline
Pocket PC: Google Hammerhead
Carrier: T-Mobile
 
Join Date: Apr 2009
Posts: 6,973
Reputation: 7530
orangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the communityorangekid is a trusted member of the community
Mentioned: 34 Post(s)
Tagged: 0 Thread(s)
Send a message via AIM to orangekid Send a message via MSN to orangekid Send a message via Yahoo to orangekid
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

I'm going to move this bad boy to Android General as it does effect every android phone, and probably has a bigger effect on phones with less than 512MB ram like MyTouch and Hero.
Reply With Quote
  #7 (permalink)  
Old 10-12-2010, 11:02 AM
NuLLKiLL's Avatar
PPCGeeks Regular
Offline
Pocket PC: Evo 4G/Epic 4G
Carrier: Sprint
 
Join Date: Jun 2007
Posts: 180
Reputation: 370
NuLLKiLL is becoming a PPCGeeks regularNuLLKiLL is becoming a PPCGeeks regularNuLLKiLL is becoming a PPCGeeks regularNuLLKiLL is becoming a PPCGeeks regular
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

The OP is right in the fact if you are killing apps your phone needs all the time to run you might hurt battery life. Programs like voice mail messaging and email (if you use them) shouldn't be closed down. It will take longer for the phone to get into them when you need it and take extra processing power that could drain the battery like 30 mins before normal.

The OP is wrong on his assertion all task killers are bad. How people use them may not be beneficial to their battery or it may. I personally always use a TK to close down the browser as it takes about 16 megs of RAM when open all the time. I also used it to see all the sprint and google bloatware running and then removing it since my phone is rooted. Again this is a great help to battery. Oh and you HAVE to use a TK before you load up a graphics intensive game or it will play laggy. Now I can hear you saying but Android manages the RAM perfect! BullShit! If it did then I wouldn't notice a difference when closing down all programs before I load up Asphalt 5. Letting andoid manage progrmas and it's choppy closing everything down and it runs smooth.

I have not heard of any real reports that TK eat your battery. We have some of the most knowledgeable guys in the industry and they don't agree. Now you may say "well these guys aren't from HTC or Google" and I would say "yeah I know their shit works unlike HTC and google." The people who fix Googles screw ups yes our devs here and at XDA are 10 time more knowledgeable than any idiot working for Google.

If you found evidence from "REAL" devs and programmers I might consider it as true but...
__________________
If I helped ya or made you laugh do me a favor and tap that Thanks!
Reply With Quote
This post has been thanked 1 times.
  #8 (permalink)  
Old 10-12-2010, 11:12 AM
mlin's Avatar
Just call me Dr. Doctor
Offline
Pocket PC: Nexus 6
Carrier: Bitch ass, big red
Location: Colorado
 
Join Date: Feb 2008
Posts: 1,621
Reputation: 2525
mlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIPmlin is a VIP
Mentioned: 2 Post(s)
Tagged: 0 Thread(s)
I tend to agree with NullKill. The ignore option is a very useful feature. I do not simply open a tk and start killing all tasks but rather things that clearly do not need to be running, such as games, or any other application that I am done with.

I've read articles that state having programs loaded in your ram is a good thing so they open more quickly. What about when I want to open something new that is CPU intensive and my ram is already nearly fully consumed? Then, theoretically, android will kill apps unused to get above the 30mb magic number but sometimes that's not good enough, especially when playing graphic intensive games.

EVO on Tapatalk
Reply With Quote
  #9 (permalink)  
Old 10-13-2010, 05:26 PM
kabuk1's Avatar
Almost a VIP
Offline
Pocket PC: HD2
Carrier: T-Mobile
Location: Norman OK
 
Join Date: Oct 2008
Posts: 753
Reputation: 870
kabuk1 knows their stuffkabuk1 knows their stuffkabuk1 knows their stuffkabuk1 knows their stuffkabuk1 knows their stuffkabuk1 knows their stuffkabuk1 knows their stuff
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Send a message via MSN to kabuk1 Send a message via Yahoo to kabuk1
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

I have read all the anti-ATK articles, and while they make sense, I still use one simply because of my personal experiences with them. I tried going without one, and my battery drained very rapidly, plus I had lockups & SODs. I like having a 'kill button' too, in case I get a rogue app. I use the ignore feature for frequently used apps that I know are safe so they don't have to relaunch all the time. I have had far more benefits with my ATK than without it.
__________________
85% of scientists are atheists. What troubles me is that there are still 15% that aren't.

kabuk1's battery life tips ~ TamsPPC

Last edited by kabuk1; 10-13-2010 at 05:28 PM.
Reply With Quote
  #10 (permalink)  
Old 10-13-2010, 09:21 PM
jimmy82's Avatar
PPCGeeks Regular
Offline
Pocket PC: EVO
Carrier: Sprint
 
Join Date: Jul 2008
Posts: 59
Reputation: 15
jimmy82 is a n00b
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: [Please, for the love of god sticky this] Task killers and why you shouldn't use

I guess the hardest thing is not knowing what to kill. An "x" like windows mobile would be great.
Reply With Quote
Reply

  PPCGeeks > Android > General Android Discussion


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 04:46 PM.


Powered by vBulletin® ©2000 - 2024, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0
©2012 - PPCGeeks.com