python程序限制运行_如何限制python程序的最大CPU利用率

如果您使用的是linux / unix平台,则可以使用nice来降低进程的优先级.

这只有在最大化的cpu时才有用.例如,如果您正在等待磁盘/交换I / O,那么真的无济于事.

NICE(1) User Commands NICE(1)

NAME

nice – run a program with modified scheduling priority

SYNOPSIS

nice [OPTION] [COMMAND [ARG]…]

DESCRIPTION

Run COMMAND with an adjusted niceness, which affects process schedul‐

ing. With no COMMAND, print the current niceness. Nicenesses range

from -20 (most favorable scheduling) to 19 (least favorable).

    原文作者:weixin_39966644
    原文地址: https://blog.csdn.net/weixin_39966644/article/details/111073939
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞