Automatically adjusting process priorities under Linux

前端 未结 7 1512
眼角桃花
眼角桃花 2021-02-20 11:52

I\'m trying to write a program that automatically sets process priorities based on a configuration file (basically path - priority pairs).

I thought the best solution wo

7条回答
  •  抹茶落季
    2021-02-20 12:37

    Sure, just iterate through /proc/nnn/exe to get the pathname of the running image. Only use the ones with slashes, the others are kernel procs.

    Check to see if you have already processed that one, otherwise look up the new priority in your configuration file and use renice(8) to tweak its priority.

提交回复
热议问题