macOS: nice/renice が機能しません。 CPU時間に実際の影響はありませんか?

macOS: nice/renice が機能しません。 CPU時間に実際の影響はありませんか?

NI次のように「良い」値( "")を見ることができますが、プロセスが使用するps実際のCPU時間には影響しないようです。

  PID  %CPU PRI NI COMM
57081  77.6  12 10 cpu-chew
57080  77.1  12  0 cpu-chew
57085  76.9  12 15 cpu-chew
57082  76.9  12 13 cpu-chew
57083  76.7  12  0 cpu-chew
57031   0.0  31  0 -tcsh

あるプロセスが他のプロセスよりも多くのCPUを確保する方法を知っている人はいますか?

==追加情報、fwiw:

MacOS 10.12.6

負の値で(再)ニースを試みるか、プロセス数が32を超えると(ただし、「ハイパースレッディング」などを最大化するために)、同じ動作が発生します。

cpu-chew平方根と増分のみを実行する短いCプログラムです(下記参照)。

「ps」を複数回実行すると、値が異なる(1-ishから14-ishまで)少し異なる順序でプロセスが提供されますが、PRIすべてのCPU-chewコピーはほぼ同じPRIorityを持ちます。PRI最後の移行以降の時間を計算するために、一種の年齢メカニズムが組み込まれていると思います。 )

nice以下は、さまざまな組み合わせで作業を開始した方法の完全な記録ですrenice

tropic: cpu-chew &
tropic: /usr/bin/nice cpu-chew &
tropic: /usr/bin/nice -n 13 cpu-chew &
tropic: cpu-chew &
tropic: cpu-chew &
tropic: ps -rc -o pid,pcpu,pri,nice,comm

  PID  %CPU PRI NI COMM
57085  78.2   1  0 cpu-chew
57083  78.0   2  0 cpu-chew
57081  77.4   3 10 cpu-chew
57080  77.2   2  0 cpu-chew
57082  76.7   2 13 cpu-chew
57031   0.0  31  0 -tcsh

tropic: /usr/bin/renice -n 15 57085
tropic: ps -rc -o pid,pcpu,pri,nice,comm

  PID  %CPU PRI NI COMM
57081  77.6  12 10 cpu-chew
57080  77.1  12  0 cpu-chew
57085  76.9  12 15 cpu-chew
57082  76.9  12 13 cpu-chew
57083  76.7  12  0 cpu-chew
57031   0.0  31  0 -tcsh

そしてもう少し接線的なもの:

tropic: cat cpu-chew.c

#include <math.h>

int main() {
    double i=2;
    while (i != sqrt(i)) 
        ++i;
    }

走るlimit姿は変ではなかった。

ベストアンサー1

おすすめ記事