Linux 进程相关的一些命令

本文介绍了如何使用chrt和nice命令调整Linux中进程的优先级,并展示了如何查看进程的实时调度策略。此外,还提供了使用ps命令查看进程详细信息的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

修改进程优先级

chrt

  • 具体细节查看man
  • chrt -r -p priority pid ,例子如下
    chrt -r -p 99 pidxxx chrt -p pid

       -f, --fifo
              Set scheduling policy to SCHED_FIFO.
    
       -i, --idle
              Set scheduling policy to SCHED_IDLE (Linux-specific). The prior‐
              ity argument has to be set to zero.
    -p, --pid
              Operate on an existing PID and do not launch a new task.
        -r, --rr
              Set scheduling policy to SCHED_RR.  When policy is  not  defined
              the SCHED_RR is used as default.
    

You can also retrieve the real-time attributes of an existing task:
chrt -p pid 可以查看实时进程的优先级调度策略

nice

  • 调整优先级

    -n, –adjustment=N
    add integer N to the niceness (default 10)

renice

man renice

查看调度策略

ps

  • ps -eo pid,tid,class | grep 23126

To see every process with a user-defined format:

          ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
          ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
          ps -Ao pid,tt,user,fname,tmout,f,wchan

查看进程在哪个cpu

top

  • top命令
  • 按f
  • 选择需要display的内容,按d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值