Question

Good evening.

My target is to create an application that runs in the background and consumes a controllable amount of recources. CPU, Memory, network resources, etc.

The user will set the time the operation will run for, the CPU consumption level, and the memory occupied by the app.

When he presses "start" the app will create the operation with a timer for a specific amount of time and will start a task that consumes the resources specified...

I am not really sure how to use controllable resources. Can someone, please point me to the right direction?

Regards,

LSonic

Was it helpful?

Solution

Once your app is in the background, you no longer have control of your resources. There are a few things that can be done to have some resources, but if your app attempts to hog or deliberately consume resources, you will be terminated.

While your app is in the foreground, you can use as much memory and CPU time as you want, but at your own hazard. If you stall the UI thread too long, you will be killed. If the system believes your background thread is hung at 100% CPU usage, you will also be killed.

Why are you trying to do this? If we knew your goals, we may be able to offer better ways to achieve them. What you are suggesting now is a dead end.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top