It's Linux.  You can use the normal Linux facilities for controlling thread
priorities.  If you want the full gory details about how Linux schedules
threads, you might want to look specifically for Linux material.  Android
runs on top of Linux, so it's the same thing.

That said, in a normal Android system, you can't prevent processes from
running at a higher priority, because sometimes applications need to do this
for example for audio processing.

If you are building your own device, you should probably be posting to
android-porting for help in your customization of the platform to serve your
needs.  (Though note that changing it to not allow apps to get higher
priorities would mean you are no longer building an Android compatible
device and thus can't have the market on it.)

That said...  are you seriously thinking about building a device where the
Android system is controlling critical things like signals and BRAKES?  And
allowing third party code to run on the system as well?  Typically smart
phones have a secondary CPU for running the radio and other critical
low-level facilities; this would seem to be an even more important
consideration for software that is controlling things like BRAKES, and
trying to have that kind of stuff run on the CPU as the normal application
environment seems...  well a recipe for disaster.

On Tue, Sep 1, 2009 at 2:12 AM, salza <[email protected]> wrote:

>
> The other system environment is a vehicle where we have many critical
> applications e.g. brake or signal lamps etc.
> Now these critical applications should have max priority.
> The question is, if this is possible.
>
> Other processes should of course not be allowed to do this because
> then the priorization would not be secure.
>
> On Aug 28, 3:59 pm, Streets Of Boston <[email protected]> wrote:
> > *Why* do you need this? What critical code do you need to execute?
> > Maybe there is another solution... maybe not...
> >
> > If you could make some code 'critical', what if other processes tried
> > to do the same?
> >
> > On Aug 28, 3:00 am, salza <[email protected]> wrote:
> >
> > > Maybe I misunderstand something.
> >
> > > Let's say thread A of process A has the priority "very important" and
> > > thread B of process B has the priority "not so important".
> > > In Android every process has its own Dalvik VM instance - so thread A
> > > is in another instance than thread B. Therefor the priority of the
> > > threads does only have an effect on other threads of the same Dalvik
> > > VM instance. Right?
> > > That's why (in my opinion) the thread priorities would not have an
> > > effect on whether thread A or thread B will be done first as they are
> > > in different Dalvik VM instances.
> >
> > > The thing I want to accomplish: I have another system environment
> > > where very critical processes exist that need a high priority. If it
> > > is not possible to sign it with a high priority I can't use Android
> > > for development in that system environment.
> >
> > > Thanks.
> >
> > > On Aug 27, 8:23 pm, Dianne Hackborn <[email protected]> wrote:
> >
> > > > No, and Linux doesn't have this facility.  When you set the nice on a
> > > > process, you are setting it on the main thread of the process.  Any
> threads
> > > > it creates after that will inherit the priority of the original
> thread,
> > > > however it will not impact any existing threads, and threads can
> later
> > > > modify their priority.
> >
> > > > The only thing you can do afaik is restrict the best priority any
> thread can
> > > > get, and that is associated with the uid and not the process.
> >
> > > > I have no clue what the relationship is between killing processes and
> > > > setting process priorities.
> >
> > > > What exactly are you wanting to accomplish?
> >
> > > > On Thu, Aug 27, 2009 at 8:52 AM, salza <[email protected]>
> wrote:
> >
> > > > > So is there any method I can use, to set the priority for a
> process?
> > > > > Linux normally has this ability (e.g. nice - Set process priority
> of
> > > > > new processes)
> >
> > > > > In the Android API I found a method to kill processes:
> killProcess(int
> > > > > pid)
> >
> > > > > So is there any possibility for me as a developer to use a method
> like
> > > > > the killProcess-method zu manage the priority of a process?
> >
> > > > > On Aug 26, 6:48 pm, Dianne Hackborn <[email protected]> wrote:
> > > > > > Linux doesn't really associate priorities with processes...  or
> more
> > > > > > accurately, in Linux a process is a unit of execution, so each
> thread is
> > > > > > also actually a process (running in the same address space), with
> their
> > > > > own
> > > > > > independent priorities.
> >
> > > > > > On Wed, Aug 26, 2009 at 4:29 AM, [email protected] <
> >
> > > > > > [email protected]> wrote:
> >
> > > > > > > Thanks!
> >
> > > > > > > Ok, I can set priority for threads... but threads running in
> > > > > > > processes... is it therefore possible to set priority for
> processes as
> > > > > > > well...?
> >
> > > > > > > On 26 Aug., 00:04, 3crowntech <[email protected]> wrote:
> > > > > > > > Hi Matthias,
> >
> > > > > > > > You can set thread priority by
> android.os.Process.setThreadPriority
> > > > > > > > method. This is how android controls resource allocation.
> > > > > > > > Thanks.
> >
> > > > > > > > On Aug 26, 5:45 am, "[email protected]" <
> [email protected]
> >
> > > > > > > > wrote:
> >
> > > > > > > > > hi all,
> >
> > > > > > > > > the Android web site indicates that "all applications are
> created
> > > > > > > > > equal". What is the strategy to ensure that critical
> applications/
> > > > > > > > > services have priority?
> >
> > > > > > > > > Are there any facilities Android does provide to ensure
> certain
> > > > > > > > > applications and/or threads to receive a minimum of CPU
> bandwith
> > > > > (and
> > > > > > > > > other apps/threads are prevented from consuming all the CPU
> > > > > bandwith)?
> >
> > > > > > > > > Matthias- Zitierten Text ausblenden -
> >
> > > > > > > > - Zitierten Text anzeigen -
> >
> > > > > > --
> > > > > > Dianne Hackborn
> > > > > > Android framework engineer
> > > > > > [email protected]
> >
> > > > > > Note: please don't send private questions to me, as I don't have
> time to
> > > > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > > > questions should be posted on public forums, where I and others
> can see
> > > > > and
> > > > > > answer them.
> >
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > [email protected]
> >
> > > > Note: please don't send private questions to me, as I don't have time
> to
> > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > questions should be posted on public forums, where I and others can
> see and
> > > > answer them.- Hide quoted text -
> >
> > > - Show quoted text -
> >
> >
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to