nice() is not nice to my app..
I'm working on an Embedded Linux kernel 22.214.171.124.
This machine runs a main utility that interacts with the kernel. Let's call this utility MainUtility.
I wrote a TestUtilty that runs for 5 seconds and increments a variable X in a loop. After 5 seconds the TestUtility displays X's value and dye.
I execute the TestUtility with different nice values while the MainUtility is running and while the MainUtility is not running.
I do not understand my findings. I hope someone here could shed some light on the matter.
(*) Please note, I did every test 100 times, and the result was consistent.
A) When the MainUtility is not running if I execute the TestUtility with nice=0,nice=-20 and nice=20 I get the following result:
nice = 0 after 5 seconds X~=1,553,500
nice = -20 after 5 seconds X~=1,345,000
nice = 20 after 5 seconds X~=1,553,500
It's strange. Shouldn't nice=-20 gets the best results?
Can someone explain why did the opposite occur?
B) When I execute the TestUtility while the MainUtility is running, with nice=0,nice=-20 and nice=20 I get the following result:
nice = 0 after 5 seconds X~=1,000,000
nice = -20 after 5 seconds X~=1,000,000
nice = 20 after 5 seconds X~=1,000,000
Can someone explain how come the nice has no effect??
Thanks from advance!