Stopping unwanted services from starting AT ALL

justageek

New Member
Joined
Apr 14, 2010
Messages
10
Reaction score
0
The subject of interpretation of a "running" vs "loaded" task is not relevant to this discussion. Resources are used in either case. I want those resources for other purposes. I am looking at this moment and see 8meg of RAM consumed by Voice Search and cant free it. STOP IT!

OK - I remove all applications I don't want and kill all activity that I done need on all computer systems (smartphone == computer system). I will have another thread related to how I can remove applications if I cant find one.

The largest resource hog that exists on my moto droid is the useless voice search service. When I kill it I get as much as 12M memory back. This depends on how many times it is instantiated.

The ONLY voice option I care about on my phone is that I can talk and be heard by the person with whom I am speaking. That's it. No need for other voice services.

The Settings->Running Services displays the voice search service and other useless services. However there is no offered method of stopping these services nor preventing them from starting (remove them from rc.local or what ever is the representation)

I currently have task killers are actively killing these tasks - kinda silly to start one task to continuously kill others. I want the resources in the task killer freed too.

How can I prevent useless services from starting without logging into the phone and hacking the linux rc.d? Most specifically Voice Search.

If there isn't a supported method I will need to use my ingenuity and the result will be posted on forums web for others to use. Since I write code for phones and Linux kernels the result of my ingenuity will work, Yet, It may not be what the android community wants as a whole. Let's make this a supported option and not a hack.

Thanks

 

dlnp22

Member
Joined
Apr 19, 2010
Messages
107
Reaction score
0
bump.

I too am interested if there's a way to do just this.
 

AnneDroid

Rescue Squad
Rescue Squad
Joined
Jan 12, 2010
Messages
2,397
Reaction score
0
You've got to stop thinking in terms of other operating systems. There's no need for a task killer. Android handles the closing of applications very well on its own. Android is different than most other phone operating systems and is closer to Linux than anything else. Lots of services and applications constantly run in the background. However, and this is important, they do not use up a ton of resources. A service or app can be loaded, yet use almost no additional memory, and 0% CPU until it actually has to do some work.

In general, killing off running services is a waste of time. This is not Windows and doesn't need to be treated as such. Android automatically asks apps to close that aren't needed when it needs more memory. Killing off some of the processes means it'll slow your phone down, as these processes will only need to reload.

You will just slow your system down by running a task killer as most task killers install services that run continually. Android reuses objects when available to eliminate the overhead of creating new objects. Shutting down apps on your own will only interfere with your system efficiency. Hope that helps!
 

iPirate

Active Member
Joined
Dec 26, 2009
Messages
1,436
Reaction score
0
There is a "task scheduler" in operating systems, it controls what task gets to run next.

All tasks are given a specific time to run before the schedule switches to the next task. After a task is finished with it's time, the schedule looks at the next task and sees if it needs access to the CPU or not; is the task "sleeping?" If the task is sleeping the schedule will skip it and run the next task that needs the CPU. The processing power to check if a process is sleeping could be less than 1 cycle of the CPU.

Ending a task requires the task to be removed from the schedule's list and requires more than a cycle of the CPU. Adding a task also requires more than one cycle of the CPU.

So ending tasks and restarting them uses more CPU than just leaving them sleeping. Also CPU cycles are used by task killers to check if tasks are running.
 

jasonb

Active Member
Joined
Dec 6, 2009
Messages
1,143
Reaction score
0
just root and use auto memory manager or a similar app. it changes the values for android task killing and kills things off quicker automatically. i constantly have about 50-70MB free and the phone flies even at 600mhz.
 

nphil

Member
Joined
Feb 16, 2010
Messages
344
Reaction score
0
Location
Atlanta, GA
Actually service processes do use CPU time and take up unnecessary memory, unlike apps that are just made dormant, i.e turned into a hidden or empty app. Android terminates these apps based on a OOM priority value table, as defined in the init.rc file. I'm not really sure what the Voicesearch app runs as, so you might just have to find out and modify the oom_adj value to a really low one. This ensures that the OS will always terminate the process.

To modify these values at runtime, edit the minfree file inside /sys/module/lowmemorykiller/parameters/ or use an app like autokiller. Both require root.

there is also an app called autostarts that modifies the init.rc file (i think), but it requires root too.
 
Last edited:

jsh1120

Silver Member
Joined
Dec 9, 2009
Messages
2,401
Reaction score
1
Location
Seattle, Washington
I'm inclined to think that VZW should provide a coupon for a basic computer science operating system class with every phone.
 

nphil

Member
Joined
Feb 16, 2010
Messages
344
Reaction score
0
Location
Atlanta, GA
I'm inclined to think that VZW should provide a coupon for a basic computer science operating system class with every phone.

if i see one more of these threads im gonna kick the s**t out of my monitor...

SEARCH THE FORUM, this topic has been beat to death and then cremated and then buried 6ft under..many many times over.

Read the post again, instead of simply drinking the anti task killer koolaid. The OP was referring specifically to processes, which are entirely different from the apps that harmlessly run in the background without using any cpu time.

Service processes DO use cpu time and memory (not a whole lot although). A lot of these can bog down your phone unlike background apps that may become hidden or empty over time without using a significant amount of memory/cpu time. Read my previous post for more info, or the post on xda-developers for even more detailed info on Android's memory management routines.
 
Last edited by a moderator:

DigiK

Member
Joined
Jan 17, 2010
Messages
188
Reaction score
0
Location
Pittsburgh, PA
I highly recommend rooting your phone. Besides being able to overclock, you'll be able to delete applications you have no use for, install Autostart to disable certain annoying services like Voice Dialer from starting, and using Autokiller to improve the automatic memory manager in your phone. Of course it's always easy to return to stock via Motorola RSD tools if you need to return your phone. ;)
 
OP
J

justageek

New Member
Joined
Apr 14, 2010
Messages
10
Reaction score
0
This is a long post - sorry...
Well i hate to confuse those that may think they know about operating systems.
But first to qualify... I write real-time-operating systems and compilers and debuggers. Have done so for decades. have a lot to learn. About operating systems as well.

But, a service (daemon in the Unix world) is retained in the kernels task control block table. It will retain its code (.text), data (.data, .rodata), heap and any other resources that it allocates until they are explicitly freed or (presuming a good garbage collector) implicitly freed by termination. Common resources that cost memory that many don't know of are ports and file handles. These look like 32 bit values in application space but they are often represented as much larger structures in kernel space or in network stacks.

The resources of a daemon in an embedded system (phone, handheld, ...) cannot intelligently be set aside into a larger space such as swapping to virtual memory on a hard drive. We don't have much of that space on these phones.

So, if the application is resident (dormant or running) it is still taking up memory. 8-12Meg last check for voice services.

Why that much memory? Well these are vocoders (voice coders). They need to be fast so they dont turn your words into little snippets of noise (clipping). So when an application wants to be fast it does something called loop unrolling. This takes a piece of code that may need to run to the end of a track many times and makes the track longer so it doesn't have to run all the way back t the begging so often. This makes it run faster. But it makes it bigger too. So, removing these big chunks of cruft from memory makes resources available for other applications.

Doing so also can reduce the time it takes to load and run programs because the memory manager and garbage collector have more resources. it doesn't have to coalesce blocks as often because it has 12meg more memory to work with. Coalescing is taking little bits and moving them all together to make a big bit - this is like the Windows 'defragmenter' except t is running all the time on memory. If it cant find chunks of memory big enough then it has to do garbage collection and/or coalescing or kill applications.

Summary: This is a very real 12Meg of memory (for the voice services alone). I have actually had 55Meg reclaimed by a task killer regularly.

OK... Task killers... This is another program that takes up memory... Seems silly to have another one in memory. What it does is it monitors tasks and kills them with some rules (like after screen blanks, or after last input, ...)

Other options discussed include using the build in task killer (garbage collector in above explanation). This is a program that you dont want to stop - even if you could. It kills applications when it is low on resources. So a suggestion is to tell it to kill tasks when it has a different "low water mark" or lowest amount of free memory. OK - this is another hack...

Here's a novel solution. Dont start the service until an application wants it. This concept is already built into many Linux distributions and its services (xinit). When the service has no more data to process it ends. So, lets be non-creative and just use what works in only starting applications when they are needed and the end when they are done.

Not rocket surgery. A bit more difficult than rocket surgery but a large number of geeks made it work reasonably consistently about a decade ago.

Down side to this is that the application that needs this service will either need to have a nominally slower start up time (thats' OK - they won't start on my phone and I have killed the service - so I am responsible or the result).

NO! rooting my phone is not an option. I have a rooted phone that I use in my work (on phones). I just want a phone that WORKS RIGHT. This is an appliance. I don't go in and change the rotation speed on my dish washer nor change the output power of the transmitters on my microwave. This is NOT a hobby phone. I have other phones (Nexus one and others) that I do this on for a living.

This mechanics car won't be broken down all the time.
 

iPirate

Active Member
Joined
Dec 26, 2009
Messages
1,436
Reaction score
0
You work on real-time-OS all day and with the N1 etc.. then write an app for yourself and sell it on the market for some extra pocket change?
 

DigiK

Member
Joined
Jan 17, 2010
Messages
188
Reaction score
0
Location
Pittsburgh, PA
NO! rooting my phone is not an option. I have a rooted phone that I use in my work (on phones). I just want a phone that WORKS RIGHT. This is an appliance. I don't go in and change the rotation speed on my dish washer nor change the output power of the transmitters on my microwave. This is NOT a hobby phone. I have other phones (Nexus one and others) that I do this on for a living.

This mechanics car won't be broken down all the time.

The idea that any device not build completely to your own specifications is going to work perfectly is an idealist fallacy. ANY OS I've ever used, I've had to make changes to in some way so that it performs better according to my usage model. Just like the mechanic, I ensure my phone is functioning as close to MY specifications as possible by making a few alterations here and there.

I too am hopeful that Android engineers rethink their service start-up implementation, but in the meantime the pragmatic solution is taking the five minutes and rooting. Rooted phones certainly CAN perform just as well in mission-critical environments, and I think the continued aversion to doing so is purely out of dogma. If you're keeping the OS stock, removing/disabling some unneeded services, and tweaking memory management, you're really only enhancing your phone while maintaining maximum stability.
 
R

Romple

Guest
You obviously know your field. But I think the ultimate answer is no, there's no way to prevent this service from starting up at all without some hack or some memory-management app like Auto Memory Manager.
 

freesoftwarefan

New Member
Joined
Nov 23, 2009
Messages
13
Reaction score
0
To have the full and fine-grained control it souunds like you want, root is necessary. If you don't want to root, then you have to accept the system's default behavior for autolaunching apps. Personally, I'm with you, I think we should have that level of control without rooting, but - we don't.
 
Top