Just out of curiosity does anyone know if any android devices can be affected by a fork bomb sent via text or email?
It is Linux so I'm guessing it will be affected. Maybe it won't be like OMG but it will be some what affected.
If a text or email could execute a custom script on being received, there is probably a lot worse that it could do than a fork bomb... Might be possible to get two views to keep calling each other, in which case the bundle for that program will expand until it runs out of memory and android will kill the app. This is very much an app specific bug though, and isn't related to the "fork bomb" of a program making a new instance of itself.
I thought Android runs on the sandbox environment for applications, which means the app can't execute much permissions as compared to Windows.
Just my $0.02
Yes, the apps are sandboxed for the most part.
Now that I think on it, there is a launch flag to open a new instance of a program leaving any currently running ones alone, which could be used to make a forkbomb. In this case, it would not be stopped by memory as the earlier instances will shut down but the exponentially increasing new instances will keep going, probably making the phone unusable until a reboot.
This can only be done by compiling and launching a signed app though, no email client can do this unless it has a backdoor to trigger this code from itself or from a trojan-esque feature to download, install, and launch apps on its own. The user would be promted to ok the new app's permissions anyway, unless it uses and gets permission for root access.
Basically, forkbombs are possible, but not by email or text with stock or nonmalacious programs.
Task Management
If the script gained root access, it'd be just the same as on a Linux machine. But I believe the DalvikVM simply kills any apps/processes it needs to in order to keep the system running smoothly (in theory).
well it works...
https://github.com/nicandris/com.example.forkbomb
Related
Running Applications
Hi, im considerably new to the whole android development i have a g1 since early december and have upgrade it to the modded JFC 1.31 ADP. I also have the adp spl i think thats what u call it .
My question relates to the running processes/tasks/programs. I am concerned about the amount of programs that run in the background. Is there a way to cut down on this?
I have already removed Calendar, Amazon, Calculator, Calendar Provider seeing as how i do not intend on using these as for calculator i have installed a scientific calculator.
Its more or less Facebook, Craigslist, Imeem. The other bckg progs Gmail, Messaging, Alarm Clock are all smth i use so therefore i have no issue on that but ive tried editing settings on Craigslist, Facebook, Imeem and others to change the update interval and have maxed those out but still tend to run in the background i use the programs but i dont need them to update themselves.
Edit: I have also stopped the auto sync on Calendar, Gmail, Contacts Seeing as for Calendar i dont need it, Gmail i check it often, Contacts i dont use on my gmail service.
Have you got the task manager app from the app store? Thats what I do, and kill all the apps I don't need active.
TimSykes said:
Have you got the task manager app from the app store? Thats what I do, and kill all the apps I don't need active.
Click to expand...
Click to collapse
Yes i have, however they keep coming back up!
yeah I know some of them do. to me I don't know why alarm does. I don't even have a alarm set on my phone.
They come back due to the way android handles and saves tasks. The OS will keep resurrecting them thinking they are just dormant and were axed by them.
ArronL said:
They come back due to the way android handles and saves tasks. The OS will keep resurrecting them thinking they are just dormant and were axed by them.
Click to expand...
Click to collapse
So is there a way around this or not?
yeah.. im having the same problem, i shut them all down via task manager, but after like 1 minute i go back in there and they all come back up, is there any way to make them be off permanentally till you use them again?
tbh, the way the android works, if it keeps bringing these programs back they're probably not eating up too much memory.
in fact, no matter how much crap is running in the background i've never experienced any lag or anything. makes me wonder if there's any point in killing apps, except for ones that may be constantly connected to the internet.
Meltus said:
tbh, the way the android works, if it keeps bringing these programs back they're probably not eating up too much memory.
in fact, no matter how much crap is running in the background i've never experienced any lag or anything. makes me wonder if there's any point in killing apps, except for ones that may be constantly connected to the internet.
Click to expand...
Click to collapse
Well i definitely notice a lag, although i agree with you on the applications i removed like 80% of them now just using ones i need and just installed the 1.41 everything works great. But run about 10apps let them run in the bckgs and slide the main application tab on the home screen up and down and scroll through the programs. Then kill about all apps but 3 to account for ones you need and try it again you should most likely notice a difference.
Not on lag but background processes use up battery to, I did a wipe and have like four apps on my phone: aim astro any cut and ak notepad (wow must like A's) but my battery life is noticible better than before, I can go a whole day with out having to charge vs having to charge every few hours
does anyone know of a startup manager for the G1 for EG when i reboot or start up my phone i get a lot of services and programs which i use but do not want to start on boot.
i can use task manager to close them once the phone is started but wouldt be happy for something that disables these from the start.
Has anyone found a way to modify what OEM apps boot at startup?
So using Task Manager for Root Users we get this peek into what's ?running? on our phone. or am i sadly confused..
upon initial boot and after letting the phone boot fully (about 3 minutes) i get this list in my taskmanager..
Task Manager ---not oem
Service Viewer ---not oem
MyFaves storage
Messaging
Voice Dialer
Google Talk
Maps
Calendar
Alarm Clock
Power Manager ---not oem
Missed Call ---not oem
Messaging
Phone Recorder ---not oem
MyFaves Storage
Voice Dialer
Google Talk
Maps
The list remains the same even after several refreshes..
...oddly only after killing a few tasks this is added?
Gmail
note: at this point in service viewer/tasks, only taskmanager, launcher and service viewer are present..
After killing every process through multiple refreshes messaging (which I assume is a critical app tied to the notification bar) is the only thing that remains until i load something else..
First question..are the apps listed in task manager actual hurting my battery/memory/cpu performance?
Secone question..Is there any way to auto-kill these tasks upon boot, other than by removing them? Or is there some boot.ini type file that could be editted?
sry for the long post, just curious if something can be done...
Yeah id also like to know how to manipulate what starts up on boot.
Any dev should be able to tell us.
Plenty of apps start at boot.
Seriously I would LOVE the answer to these questions. Thanks
Now while this isn't coming from a dev, when I look at the running app list I often see things I haven't touched, but they won't start unless the phone's been idle. I think what happens is it actively fills empty ram with programs so they will start faster, so I think it's just in the nature of Android.
Fushichou said:
Now while this isn't coming from a dev, when I look at the running app list I often see things I haven't touched, but they won't start unless the phone's been idle. I think what happens is it actively fills empty ram with programs so they will start faster, so I think it's just in the nature of Android.
Click to expand...
Click to collapse
yes but dont they use up cpu/memory/battery? plus i dont think the programs are so resource heavy that they would need a process running.
An answer from a Dev is what we need
I think what we need is an explaination as HOW a program can autostart on boot. If every program on my phone (stored to sd) started automatically when I turned on my phone I'll be waiting a week for it to start up. There has to be a script that these programs add to or something to run these program automatically. Either that or it's the programs themselves that are set up to start up by themselves. Where if that's the case I think we're screwed.
I'm also VERY interested in this.
Also, how to keep apps from auto-restarting once you kill them. PixelPipe has a background service that, once you start the app after reboot, it won't die. Their app support guy states otherwise tho, heh.
Also, I like how the OS says a program has "died"
I wouldn't really worry about it. For one most of those processes will be sleeping. They use no CPU time when they're in this state. Some processes register an event with the kernel and just sleep forever until that event occurs and the kernel reactivates the process. Some processes sleep for a specific amount of time, wake up and do some task, then go back to sleep. In both cases the number of CPU cycles being used are likely negligible. Most of those start-up programs will fall into one or the other category. The stuff that does take up a fair amount of CPU cycles are things like the multimedia system, the UI system, messenging, etc. In other words, the stuff you want to keep running.
Also, I wouldn't pay too much attention to those memory usage numbers. There's heavy use of shared libraries in the system. Ordinarily processes are only allowed to access memory that is allocated to them. This memory is where the process stores the bits that make up its code (stuff that doesn't change) and where it stores its working data (stuff that does change). Its actually more complicated than that but this will suffice for now. Libraries that are not shared are accessible only to the process that is using it and is stored in the memory allocated to it. Libraries that are shared can be used by multiple processes. These shared libraries are allocated to one place in RAM and when an app needs to use one of them the kernel takes care of mapping the location of the library so the app can access it as if it was in its own memory space.
The memory usage numbers you are seeing do not take into account these shared libraries. An app may be using only 1 or 2 MB of RAM but since it uses a shared library the RAM being used to hold the library is also counted and the size could be shown as 20 or 30 MB higher that what it actually is. You could kill a process and recover some memory but its probably not enough to be worth it since more than likely most of the RAM being used was in shared libraries and they'll still be there after the process is gone.
numerik, thanks for the info. But now I guess my bigger concern would have to do with this part:
Some processes sleep for a specific amount of time, wake up and do some task, then go back to sleep.
Click to expand...
Click to collapse
Similar to the problems we run into in windows. Some lame program gets added to msconfig (be it a m$ app or wicked virus), it sits there idle when you fire up your computer uses a minimal amount of cpu amd memory then does who knows what whenever it wants.
Apps starting on their own. Anyone have these issues? All the att stuff is gone but the video and music player are open randomly as well as quik office. I can see gmail opening and others tho check for updates
Sent from my SAMSUNG-SGH-I897 using XDA App
Yes, this annoys the hell out of me. I wish I knew what to do to stop it. I've even downloaded an app that's supposed to stop things from auto-starting, and it doesn't even work.
Search for StartUp Auditor on the market, it may work for you.
Android Market description
Startup Auditor is one of the original task killer & task manager apps. It is a boot monitor and startup monitor tool which displays a list of applications you may disable.
Terminate processes automatically.
Enable/Disable apps& keep disabled. No root.
Full version eliminates ads and can disable unlimited!
Package: com.vesperaNovus.app.StartupAuditorFree
Click to expand...
Click to collapse
On the advice of this forum I uninstalled my app killer. From time to time I use Android System to see what's running and I notice a number of apps that start themselves. These include the stock music and video players along with Slacker Radio, AT$T Maps, eBay, GPS Status and a dozen others at various times. I don't mean they remain running after exiting, I mean they start without my having used them. What could be causing these apps to start when not called upon? The ones that use GPS put a significant drain on the battery without me knowing it. Any ideas what triggers these apps? I think I'm going back to using an app killer.
Miami_Son said:
On the advice of this forum I uninstalled my app killer. From time to time I use Android System to see what's running and I notice a number of apps that start themselves. These include the stock music and video players along with Slacker Radio, AT$T Maps, eBay, GPS Status and a dozen others at various times. I don't mean they remain running after exiting, I mean they start without my having used them. What could be causing these apps to start when not called upon? The ones that use GPS put a significant drain on the battery without me knowing it. Any ideas what triggers these apps? I think I'm going back to using an app killer.
Click to expand...
Click to collapse
Mine does the same thing. I have Advanced task killer on mine. I dont use it to kill apps, just to look and see how much ram is free and whats running. But all kinds of junk opens by itself.
so does anyone have a fix for this?
derek4484 said:
Mine does the same thing. I have Advanced task killer on mine. I dont use it to kill apps, just to look and see how much ram is free and whats running. But all kinds of junk opens by itself.
Click to expand...
Click to collapse
What use is free RAM when it is kept free all the time?
AJerman said:
Yes, this annoys the hell out of me. I wish I knew what to do to stop it. I've even downloaded an app that's supposed to stop things from auto-starting, and it doesn't even work.
Click to expand...
Click to collapse
Use "start up auditor". With personal experience, this only slowed down my system.
dieselstation said:
so does anyone have a fix for this?
Click to expand...
Click to collapse
This is now android works. The way I see this, this is very much similar to "pre-fetch" concept in windows 7.
I have a 6 GB RAM laptop. Base OS uses less than 1.5 GB of RAM. But like an hour or so when I see my RAM usage, its to the tune of 3-4 GB. What I have noticed is that my most frequently/recently used apps are loaded to RAM and kept there idle. Some amount of RAM is always kept free instead of using up all RAM. This way apps start faster. When I load a different memory heavy program, it pushes the existing one out and loads this.
More or less the same in android too. When u go to any task manager app n see the running apps, u'll notice that many of the apps loaded are the ones u use frequently.
These apps do NOT use any CPU. They are just loaded to memory and kept there for quick access.
When I boot up my phone I have like 190+ MB free RAM. Though left in standy mode, within an hour, I see my free RAM fall to 80-120 MB range. I never saw it go less than 80 MB. And the apps in memory are the ones I used the last time, and the ones I use all the time.
Even if u use a task killer to kill these "inactive" apps at intervals, they would be loaded again sooner or later. That's the principle of android. So by using task killers, though u feel u r freeing up memory, in fact, u r only draining ur battery. What's the use of memory if u r not using it effectively.
Don't worry abt free RAM amount. Let android manage it. Systems are intelligent enough these days.
Hope this helps.
All well and good, but when I look at what apps are using the most resources, the GPS-enabled apps are almost always near the top of the list even when I haven't been doing anything with them. That tells me that they are stealing processor time even when not being used and that can't be good for battery usage.
Miami_Son said:
All well and good, but when I look at what apps are using the most resources, the GPS-enabled apps are almost always near the top of the list even when I haven't been doing anything with them. That tells me that they are stealing processor time even when not being used and that can't be good for battery usage.
Click to expand...
Click to collapse
Install Spare Parts and see battery usage. Do u see any GPS time under CPU usage. Though my system has all these apps loaded up, they don't show up as using CPU time or any sensors unless I use the app.
Android Memory Management
Android Memory Management
Android is a Linux based OS with 2.6.x kernel, stripped down to handle most tasks pretty well. It uses native open source C libraries that have powered Linux machines for years. All the basic OS operations like I/O, memory management, and so on, are handled by the native stripped-down Linux kernel.
How to use memory for each application
Android’s process and memory management is a little unusual. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the process lifetimes. Android ensures application responsiveness by stopping and killing processes as necessary to free resources for higher-priority applications.
Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memory and process management to the Android run time, which stops and kills processes as necessary to manage resources.
Dalvik and the Android run time sit on top of a Linux kernel that handles low-level hardware interaction including drivers and memory management, while a set of APIs provides access to all of the under- lying services, features, and hardware.
Dalvik Virtual Machine Dalvik is a register-based virtual machine that’s been optimized to ensure that a device can run multiple instances efficiently. It relies on the Linux kernel for threading and low-level memory management.
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik virtual machine. Rather than use a traditional Java virtual machine (VM) such as Java ME (Java Mobile Edition), Android uses its own custom VM designed to ensure that multiple instances run efficiently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality including security, threading, and process and memory management.
All Android hardware and system service access is managed using Dalvik as a middle tier. By using a VM to host application execution, developers have an abstraction layer that ensures they never have to worry about a particular hardware implementation.
The Dalvik VM executes Dalvik executable files, a format optimized to ensure minimal memory foot- print. The .dex executables are created by transforming Java language compiled classes using the tools supplied within the SDK.
Understanding Application Priority and Process States
The order in which processes are killed to reclaim resources is determined by the priority of the hosted applications. An application’s priority is equal to its highest-priority component.
Where two applications have the same priority, the process that has been at a lower priority longest will be killed first. Process priority is also affected by interprocess dependencies; if an application has a dependency on a Service or Content Provider supplied by a second application, the secondary application will have at least as high a priority as the application it supports.
All Android applications will remain running and in memory until the system needs its resources for other applications.
It’s important to structure your application correctly to ensure that its priority is appropriate for the work it’s doing. If you don’t, your application could be killed while it’s in the middle of something important.
The following list details each of the application states shown in Figure (see the attached image) explaining how the state is determined by the application components comprising it:
Active Processes Active (foreground) processes are those hosting applications with components currently interacting with the user. These are the processes Android is trying to keep responsive by reclaiming resources. There are generally very few of these processes, and they will be killed only as a last resort.
Active processes include:
* Activities in an “active” state; that is, they are in the foreground and responding to user events. You will explore Activity states in greater detail later in this chapter.
* Activities, Services, or Broadcast Receivers that are currently executing an onReceive event handler.
* Services that are executing an onStart, onCreate, or onDestroy event handler.
Visible Processes Visible, but inactive processes are those hosting “visible” Activities. As the name suggests, visible Activities are visible, but they aren’t in the foreground or responding to user events. This happens when an Activity is only partially obscured (by a non-full-screen or transparent Activity). There are generally very few visible processes, and they’ll only be killed in extreme circumstances to allow active processes to continue.
Started Service Processes Processes hosting Services that have been started. Services support ongoing processing that should continue without a visible interface. Because Services don’t interact directly with the user, they receive a slightly lower priority than visible Activities. They are still considered to be foreground processes and won’t be killed unless resources are needed for active or visible processes.
Background Processes Processes hosting Activities that aren’t visible and that don’t have any Services that have been started are considered background processes. There will generally be a large number of background processes that Android will kill using a last-seen-first-killed pat- tern to obtain resources for foreground processes.
Empty Processes To improve overall system performance, Android often retains applications in memory after they have reached the end of their lifetimes. Android maintains this cache to improve the start-up time of applications when they’re re-launched. These processes are rou- tinely killed as required.
How to use memory efficiently
Android manages opened applications which are running in the background, so officially you shouldn’t care about that. This means that it closes the applications when the system needs more memory. However, most android users are not very satisfied with how it does its things because sometimes it leaves too many processes running which causes sluggishness’ in everyday performance. We can use advanced task killer/task manager and it does its job very well.
Source:
Code:
http://mobworld.wordpress.com/2010/07/05/memory-management-in-android/
Still doesn't answer the question of why the OS is starting apps randomly and without need. For instance, I have Titanium Backup and SGS Tools installed, but can't use them because I am not yet rooted. So why do I keep finding both programs started in the process list? Is the app making the call to start? If so, what can I change to stop it? Whatever Android does to manage memory, it just seems stupid for it to load programs that are hardly used without my asking it to.
Miami_Son said:
Still doesn't answer the question of why the OS is starting apps randomly and without need. For instance, I have Titanium Backup and SGS Tools installed, but can't use them because I am not yet rooted. So why do I keep finding both programs started in the process list? Is the app making the call to start? If so, what can I change to stop it? Whatever Android does to manage memory, it just seems stupid for it to load programs that are hardly used without my asking it to.
Click to expand...
Click to collapse
This is how the systems work in most systems, not just in android.
Take the new cars for instance. Power is generally sent to brakes when in low gears, though u r not actively engaging them. Why? Since u r at low speeds, higher probability of applying brakes. And when u do apply, since there is already some power already being sent, its faster to brake.
On similar lines is this principle of loading apps into memory in android too. It won't load apps to fill up ur memory. Plus the apps loaded into memory in this way don't use any CPU time (this means no battery usage). This speeds up system.
On a side note, if u feel u really do not need an app, and dont' want android loading that app, get "startup auditor" from market. Select the apps u don't want to persist in memory and don't want to auto start. Beware of one thing here: if u make an app as 'do not persist' in memory, and that app is started manually or by any other app, it would be killed giving FC in the app that's using it.
Note: I coined the term 'do not persist'. I do not have the app anymore to check for the exact term.
Edit: In windows, this pre-fetching is done through a service. And one can disable that service, though not recommended. I am not sure if this is done through a service that is "stoppable" in android.
by default android seems to royally suck at it. i'm hoping for a way to force android to give all available resources to the active app? to me it seems like common sense but it seems that everything is ran on an average priority which means whatever i'm doing is battling it out with random other things in the background whereas the active app (the one i'm using) is more important than anything else android is doing.
It was one of the root-required task managers on the market... It allowed you to increase some number that might have been priority-related, but that's all I remember. Hopefully those hints will give you something to look for.
Sent from my Wildfire S
Just use zeppelinrox's V6-turbocharger and the "bulletproof" tweaks, you'll have to do it manually for each app you want to stick around, but it works like a charm. And it's free, unlike the Market apps...
hmm, any idea for the market app?
Searched around the bulletprof, but its a little difficult
Why not use "htop"?
With a rooted phone & terminal emulator & hackers keyboard this is not a problem
The only difficulty is to find the right process - they are all named app_(?) (or similar).
But if the process really needs the whole system resources you could easily identify it!
Yup, all it takes is :
-a rooted phone (you need it to modify the system settings)
- a terminal emulator [any one will do. I use Better Terminal Emulator but it's the Rolls Royce of terminals, because I spend quite a lot of time scripting with the BASH shell, so a good terminal is mandatory for comfort of use ]
- a little knowledge of shell (all you need to know is how to open the terminal, the "su" command to switch to superuser mode, "top" to see which are the running processes, "echo" to send the value into the required variable, and "kill" to kill a running process if need be), not really rocket science...
Now if you insist on using an app (that's probably not free), be my guest..
But don't ask me which one to use, because I ain't got a friggin' clue about that..
This is something I have been wondering for a while and after searching the forums and Google I have not been able to find a clear answer. As a long time Linux user the idea of running your system as root all the time is appalling. It is a huge security risk. But for some reason that is really the only way to gain root access on an Android device (as far as i am aware). Apps like SuperSU allow you to pick the apps that are allowed to run as root, but there is no password or verification that the entity approving the access actually has the authority to do so. I hear all the time that rooting your phone is a trade-off between customizability and security, but every Linux system has a root user and it is incredibly secure when properly administered. What is the reason for the difference?
From what I have read, it sounds like part of the issue has to do with Android handling users differently. I would love to be able to maintain a more limited root function on my devices. Thanks.
funkbuqet said:
This is something I have been wondering for a while and after searching the forums and Google I have not been able to find a clear answer. As a long time Linux user the idea of running your system as root all the time is appalling. It is a huge security risk. But for some reason that is really the only way to gain root access on an Android device (as far as i am aware). Apps like SuperSU allow you to pick the apps that are allowed to run as root, but there is no password or verification that the entity approving the access actually has the authority to do so. I hear all the time that rooting your phone is a trade-off between customizability and security, but every Linux system has a root user and it is incredibly secure when properly administered. What is the reason for the difference?
From what I have read, it sounds like part of the issue has to do with Android handling users differently. I would love to be able to maintain a more limited root function on my devices. Thanks.
Click to expand...
Click to collapse
You can set a passcode with SuperSU....
Thanks for the reply. That is good to know. Does that really fill the security gap though? I guess if I set My non-background root permissions to expire every 15 minutes that does help for apps that do not need to run as root in the background.
I am more referring to the distinction between regular user land and the root user. Titanium Backup for example; If I want it to be able to run a full backup (including system apps and settings) of my phone every night I have to give it permanent root permissions. That root permission applies to both the automatic process and anything that I as a user (or any entity that can get control of TB) to act as root as well. Ideally there would be 2 separate instances of the program; the back-up process (a daemon perhaps) initiated by the root user and a second available in regular user space. This sort of thing is common on Linux systems.
My knowledge of Android is not particularly deep. I cannot tell if there is actually a separate root user or how user/group permissions work. It seems that the Android framework is designed around the user not having root access. Which is a bit confusing for an OS that prides itself on customization and "Be together not the same". I can't imagine buying a desktop PC that didn't allow me to have system level (root) access. Why should it be any different on a mobile device?
Hello all, got a rather unique question that I hope someone can shred some ideas.
What I am trying to do is the following:
1.) Run a particular android application that sends push notifications periodically.
2.) Convert the push notification into a CSV file and saved it in a Dropbox. folder. I can already sort of solved this via applications such as Automate, Tasker, Automagic, etc.
3.) Be able to run this application off an ANDROID EMULATOR installed on Windows and all ON a VPS.
One reason for running it on VPS is that I need this application with the push notifications to be "monitored" continuously for several hours a day, 5 days a week. It is EXTREMELY CRITICAL that I don't miss a single push notification from my end, so the VPS provides me with the guaranteed 99.99% uptime and is much more reliable than if were to run it off my own mobile phone. Another reason is that I will be using a VPS anyway to run another program (python FYI) that automatically reads the "CSV file" created from the push notification through Automate/Tasker/etc.
It is a unique situation, but I can't think of another way that could make use of the "text" from the push notifications received from this particular application. So any ideas would be great.
If all else fail, my fall back position is run it on a physical mobile phone, but I need to find ways to make sure it can achieve 99.9%+ internet uptime.
Thanks all!