Mac 10.13.4 - `renice` seems to have no effect

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












I am trying to test out the renice command on my Mac, it seems to be having no effect. This is how I'm testing it:



I have a dual core CPU with hyper threading, so I run 6 instances of node -e 'while(1)' which, combined, max out my CPU. (Alternatively, run while true; do echo running > /dev/null ; done if you dont have node.)



I then get a PID of one of the node processes, either by the activity monitor application or pgrep, and then run sudo renice -n 19 -p $PID.



By looking at the activity monitor application or htop, the CPU usage of all of the node processes are still equivalent:



enter image description here



My understanding was that the process that I reniced would have a low priority, and so would not use a significant amount of CPU time when there are other processes using it.



Am I misunderstanding something about renice? Or is this a bug in Mac OS?







share|improve this question

















  • 3




    You have four cores, and you have four running processes. Why would each not get their own core?
    – Ignacio Vazquez-Abrams
    May 8 at 5:58







  • 3




    A nice process would still get 100% of a CPU if it was available to it.
    – Kusalananda
    May 8 at 6:10










  • @IgnacioVazquez-Abrams No, I have 2 cores, with hyperthreading. Hyperthreading gives, on average is about 30% of a core's worth of performance. Therefore 4 threads may not (on avg) be able to run in parallel.
    – Dylanthepiguy
    May 8 at 7:52










  • @IgnacioVazquez-Abrams , @Kusalananda , I can add more node processes, e.g. 6, and the same effect is produced - same cpu usage. I have edited my question to show this
    – Dylanthepiguy
    May 8 at 7:53







  • 1




    Running some rudimentary tests I’m seeing this too on 10.13.4. The curious thing is that on my FreeBSD system the Priority of a process shifts with the niceness. On macOS the Priority remains the same, so I wonder if it is a bug. Might be worth flagging to Apple if anyone has an appropriate account.
    – forquare
    May 18 at 8:26














up vote
-1
down vote

favorite












I am trying to test out the renice command on my Mac, it seems to be having no effect. This is how I'm testing it:



I have a dual core CPU with hyper threading, so I run 6 instances of node -e 'while(1)' which, combined, max out my CPU. (Alternatively, run while true; do echo running > /dev/null ; done if you dont have node.)



I then get a PID of one of the node processes, either by the activity monitor application or pgrep, and then run sudo renice -n 19 -p $PID.



By looking at the activity monitor application or htop, the CPU usage of all of the node processes are still equivalent:



enter image description here



My understanding was that the process that I reniced would have a low priority, and so would not use a significant amount of CPU time when there are other processes using it.



Am I misunderstanding something about renice? Or is this a bug in Mac OS?







share|improve this question

















  • 3




    You have four cores, and you have four running processes. Why would each not get their own core?
    – Ignacio Vazquez-Abrams
    May 8 at 5:58







  • 3




    A nice process would still get 100% of a CPU if it was available to it.
    – Kusalananda
    May 8 at 6:10










  • @IgnacioVazquez-Abrams No, I have 2 cores, with hyperthreading. Hyperthreading gives, on average is about 30% of a core's worth of performance. Therefore 4 threads may not (on avg) be able to run in parallel.
    – Dylanthepiguy
    May 8 at 7:52










  • @IgnacioVazquez-Abrams , @Kusalananda , I can add more node processes, e.g. 6, and the same effect is produced - same cpu usage. I have edited my question to show this
    – Dylanthepiguy
    May 8 at 7:53







  • 1




    Running some rudimentary tests I’m seeing this too on 10.13.4. The curious thing is that on my FreeBSD system the Priority of a process shifts with the niceness. On macOS the Priority remains the same, so I wonder if it is a bug. Might be worth flagging to Apple if anyone has an appropriate account.
    – forquare
    May 18 at 8:26












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I am trying to test out the renice command on my Mac, it seems to be having no effect. This is how I'm testing it:



I have a dual core CPU with hyper threading, so I run 6 instances of node -e 'while(1)' which, combined, max out my CPU. (Alternatively, run while true; do echo running > /dev/null ; done if you dont have node.)



I then get a PID of one of the node processes, either by the activity monitor application or pgrep, and then run sudo renice -n 19 -p $PID.



By looking at the activity monitor application or htop, the CPU usage of all of the node processes are still equivalent:



enter image description here



My understanding was that the process that I reniced would have a low priority, and so would not use a significant amount of CPU time when there are other processes using it.



Am I misunderstanding something about renice? Or is this a bug in Mac OS?







share|improve this question













I am trying to test out the renice command on my Mac, it seems to be having no effect. This is how I'm testing it:



I have a dual core CPU with hyper threading, so I run 6 instances of node -e 'while(1)' which, combined, max out my CPU. (Alternatively, run while true; do echo running > /dev/null ; done if you dont have node.)



I then get a PID of one of the node processes, either by the activity monitor application or pgrep, and then run sudo renice -n 19 -p $PID.



By looking at the activity monitor application or htop, the CPU usage of all of the node processes are still equivalent:



enter image description here



My understanding was that the process that I reniced would have a low priority, and so would not use a significant amount of CPU time when there are other processes using it.



Am I misunderstanding something about renice? Or is this a bug in Mac OS?









share|improve this question












share|improve this question




share|improve this question








edited May 17 at 9:44
























asked May 8 at 5:56









Dylanthepiguy

1085




1085







  • 3




    You have four cores, and you have four running processes. Why would each not get their own core?
    – Ignacio Vazquez-Abrams
    May 8 at 5:58







  • 3




    A nice process would still get 100% of a CPU if it was available to it.
    – Kusalananda
    May 8 at 6:10










  • @IgnacioVazquez-Abrams No, I have 2 cores, with hyperthreading. Hyperthreading gives, on average is about 30% of a core's worth of performance. Therefore 4 threads may not (on avg) be able to run in parallel.
    – Dylanthepiguy
    May 8 at 7:52










  • @IgnacioVazquez-Abrams , @Kusalananda , I can add more node processes, e.g. 6, and the same effect is produced - same cpu usage. I have edited my question to show this
    – Dylanthepiguy
    May 8 at 7:53







  • 1




    Running some rudimentary tests I’m seeing this too on 10.13.4. The curious thing is that on my FreeBSD system the Priority of a process shifts with the niceness. On macOS the Priority remains the same, so I wonder if it is a bug. Might be worth flagging to Apple if anyone has an appropriate account.
    – forquare
    May 18 at 8:26












  • 3




    You have four cores, and you have four running processes. Why would each not get their own core?
    – Ignacio Vazquez-Abrams
    May 8 at 5:58







  • 3




    A nice process would still get 100% of a CPU if it was available to it.
    – Kusalananda
    May 8 at 6:10










  • @IgnacioVazquez-Abrams No, I have 2 cores, with hyperthreading. Hyperthreading gives, on average is about 30% of a core's worth of performance. Therefore 4 threads may not (on avg) be able to run in parallel.
    – Dylanthepiguy
    May 8 at 7:52










  • @IgnacioVazquez-Abrams , @Kusalananda , I can add more node processes, e.g. 6, and the same effect is produced - same cpu usage. I have edited my question to show this
    – Dylanthepiguy
    May 8 at 7:53







  • 1




    Running some rudimentary tests I’m seeing this too on 10.13.4. The curious thing is that on my FreeBSD system the Priority of a process shifts with the niceness. On macOS the Priority remains the same, so I wonder if it is a bug. Might be worth flagging to Apple if anyone has an appropriate account.
    – forquare
    May 18 at 8:26







3




3




You have four cores, and you have four running processes. Why would each not get their own core?
– Ignacio Vazquez-Abrams
May 8 at 5:58





You have four cores, and you have four running processes. Why would each not get their own core?
– Ignacio Vazquez-Abrams
May 8 at 5:58





3




3




A nice process would still get 100% of a CPU if it was available to it.
– Kusalananda
May 8 at 6:10




A nice process would still get 100% of a CPU if it was available to it.
– Kusalananda
May 8 at 6:10












@IgnacioVazquez-Abrams No, I have 2 cores, with hyperthreading. Hyperthreading gives, on average is about 30% of a core's worth of performance. Therefore 4 threads may not (on avg) be able to run in parallel.
– Dylanthepiguy
May 8 at 7:52




@IgnacioVazquez-Abrams No, I have 2 cores, with hyperthreading. Hyperthreading gives, on average is about 30% of a core's worth of performance. Therefore 4 threads may not (on avg) be able to run in parallel.
– Dylanthepiguy
May 8 at 7:52












@IgnacioVazquez-Abrams , @Kusalananda , I can add more node processes, e.g. 6, and the same effect is produced - same cpu usage. I have edited my question to show this
– Dylanthepiguy
May 8 at 7:53





@IgnacioVazquez-Abrams , @Kusalananda , I can add more node processes, e.g. 6, and the same effect is produced - same cpu usage. I have edited my question to show this
– Dylanthepiguy
May 8 at 7:53





1




1




Running some rudimentary tests I’m seeing this too on 10.13.4. The curious thing is that on my FreeBSD system the Priority of a process shifts with the niceness. On macOS the Priority remains the same, so I wonder if it is a bug. Might be worth flagging to Apple if anyone has an appropriate account.
– forquare
May 18 at 8:26




Running some rudimentary tests I’m seeing this too on 10.13.4. The curious thing is that on my FreeBSD system the Priority of a process shifts with the niceness. On macOS the Priority remains the same, so I wonder if it is a bug. Might be worth flagging to Apple if anyone has an appropriate account.
– forquare
May 18 at 8:26










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Running some rudimentary tests I’m seeing this too on 10.13.4.



I wrote a small C program called looper which did some basic maths in an infinite loop:



#include <stdio.h>

int main()
unsigned long long prev = 0;
unsigned long long current = 1;
unsigned long long total = 0;

while(1)
total = current + prev;
prev = current;
current = total;
printf("%llun", total);




I ran multiple copies of this on my FreeBSD box and examined them using htop(1). Using renice(8) I could see the Nice value being incremented, the Priority value being incremented, and the CPU percentage decreasing - expected behavior.



I ran the same program on macOS 10.13.4 and repeated the process. While I could see the Nice value incrementing, the Priority value and CPU percentage remained consistent.



I wonder if it is a bug, I've not had cause to look this closely at Nice values in macOS before - the behavior has been close enough to what I expected that I've not been inclined to investigate.



If you have a developer account it would be worth reporting this to Apple.






share|improve this answer

















  • 1




    Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
    – Dylanthepiguy
    May 18 at 8:58










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442470%2fmac-10-13-4-renice-seems-to-have-no-effect%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Running some rudimentary tests I’m seeing this too on 10.13.4.



I wrote a small C program called looper which did some basic maths in an infinite loop:



#include <stdio.h>

int main()
unsigned long long prev = 0;
unsigned long long current = 1;
unsigned long long total = 0;

while(1)
total = current + prev;
prev = current;
current = total;
printf("%llun", total);




I ran multiple copies of this on my FreeBSD box and examined them using htop(1). Using renice(8) I could see the Nice value being incremented, the Priority value being incremented, and the CPU percentage decreasing - expected behavior.



I ran the same program on macOS 10.13.4 and repeated the process. While I could see the Nice value incrementing, the Priority value and CPU percentage remained consistent.



I wonder if it is a bug, I've not had cause to look this closely at Nice values in macOS before - the behavior has been close enough to what I expected that I've not been inclined to investigate.



If you have a developer account it would be worth reporting this to Apple.






share|improve this answer

















  • 1




    Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
    – Dylanthepiguy
    May 18 at 8:58














up vote
1
down vote



accepted










Running some rudimentary tests I’m seeing this too on 10.13.4.



I wrote a small C program called looper which did some basic maths in an infinite loop:



#include <stdio.h>

int main()
unsigned long long prev = 0;
unsigned long long current = 1;
unsigned long long total = 0;

while(1)
total = current + prev;
prev = current;
current = total;
printf("%llun", total);




I ran multiple copies of this on my FreeBSD box and examined them using htop(1). Using renice(8) I could see the Nice value being incremented, the Priority value being incremented, and the CPU percentage decreasing - expected behavior.



I ran the same program on macOS 10.13.4 and repeated the process. While I could see the Nice value incrementing, the Priority value and CPU percentage remained consistent.



I wonder if it is a bug, I've not had cause to look this closely at Nice values in macOS before - the behavior has been close enough to what I expected that I've not been inclined to investigate.



If you have a developer account it would be worth reporting this to Apple.






share|improve this answer

















  • 1




    Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
    – Dylanthepiguy
    May 18 at 8:58












up vote
1
down vote



accepted







up vote
1
down vote



accepted






Running some rudimentary tests I’m seeing this too on 10.13.4.



I wrote a small C program called looper which did some basic maths in an infinite loop:



#include <stdio.h>

int main()
unsigned long long prev = 0;
unsigned long long current = 1;
unsigned long long total = 0;

while(1)
total = current + prev;
prev = current;
current = total;
printf("%llun", total);




I ran multiple copies of this on my FreeBSD box and examined them using htop(1). Using renice(8) I could see the Nice value being incremented, the Priority value being incremented, and the CPU percentage decreasing - expected behavior.



I ran the same program on macOS 10.13.4 and repeated the process. While I could see the Nice value incrementing, the Priority value and CPU percentage remained consistent.



I wonder if it is a bug, I've not had cause to look this closely at Nice values in macOS before - the behavior has been close enough to what I expected that I've not been inclined to investigate.



If you have a developer account it would be worth reporting this to Apple.






share|improve this answer













Running some rudimentary tests I’m seeing this too on 10.13.4.



I wrote a small C program called looper which did some basic maths in an infinite loop:



#include <stdio.h>

int main()
unsigned long long prev = 0;
unsigned long long current = 1;
unsigned long long total = 0;

while(1)
total = current + prev;
prev = current;
current = total;
printf("%llun", total);




I ran multiple copies of this on my FreeBSD box and examined them using htop(1). Using renice(8) I could see the Nice value being incremented, the Priority value being incremented, and the CPU percentage decreasing - expected behavior.



I ran the same program on macOS 10.13.4 and repeated the process. While I could see the Nice value incrementing, the Priority value and CPU percentage remained consistent.



I wonder if it is a bug, I've not had cause to look this closely at Nice values in macOS before - the behavior has been close enough to what I expected that I've not been inclined to investigate.



If you have a developer account it would be worth reporting this to Apple.







share|improve this answer













share|improve this answer



share|improve this answer











answered May 18 at 8:52









forquare

2,20531228




2,20531228







  • 1




    Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
    – Dylanthepiguy
    May 18 at 8:58












  • 1




    Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
    – Dylanthepiguy
    May 18 at 8:58







1




1




Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
– Dylanthepiguy
May 18 at 8:58




Thanks! I have been able to replicate that the priority has not been increased using ps -o pid,comm,pri,nice -p $(pgrep node). I've reported this to apple again on their developer bug reporter. Hopefully we get a response in any reasonable amount of time!
– Dylanthepiguy
May 18 at 8:58












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442470%2fmac-10-13-4-renice-seems-to-have-no-effect%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?