AMS-进程管理

本文介绍了Android系统中进程的管理方式,包括进程调度的优先级分类,如Foreground、Visible、Service、Background、Empty类,并指出ProcessRecord类的setSchedGroup方法用于设置进程调度组。同时,详细讨论了OOM(Out-of-Memory)控制机制,ProcessList类定义了不同状态进程的oom_adj值,用于决定在内存不足时哪些进程会被优先清理。ActivityManagerService的mLruProcesses使用LRU算法管理进程,调度越少的进程优先分配CPU资源。
摘要由CSDN通过智能技术生成

进程调度:

进程优先级:没有发现一个和进程优先级直接挂钩的成员。但是应该跟一下内容有关:

* Android将应用进程分为五大类,分别是Foreground类,Visible类,Service类,

   Background类,Empty类。重要性是由高到低,应该算是进程优先级由高到低。

   这个可以作为进程调度优先级的依据,也可以作为OOM控制的依据。

* Process类中一些方法,如:

   /**
     * Sets the scheduling group for a process and all child threads
     * @hide
     * @param pid The identifier of the process to change.
     * @param group The target group for this process from THREAD_GROUP_*.
     *
     * @throws IllegalArgumentException Throws IllegalArgumentException if
     * <var>tid</var> does not exist.
     * @throws SecurityException Throws SecurityException if your process does
     * not have permission to modify the given thread, or to use the given
     * priority.
     *
     * group == THREAD_GROUP_DEFAULT means to move all non-background priority
     * threads to the foreground scheduling group, but to leave background
     * priority threads alone.  group == THREAD_GROUP_BG_NONINTERACTIVE moves all
     * threads, regardless of p

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值