You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/03/18 22:30:20 UTC

[GitHub] [incubator-nuttx] patacongo edited a comment on issue #2935: Bug: sporadic scheduling does not work for multiple threads

patacongo edited a comment on issue #2935:
URL: https://github.com/apache/incubator-nuttx/issues/2935#issuecomment-802351435


   I have incorporated a modified version of your test case into the OS test.  The is #apache/incubator-nuttx/3097 and #apache/incubator-nuttx-apps/620
   
   Here is some sample output (using your priorities):
   
   ```
   user_main: Dual sporadic thread test
   Sporadic 1: prio high 180, low 20, repl 100000000 ns
   Sporadic 2: prio high 180, low 20, repl 100000000 ns
     1 Sporadic 1 budget 000000000 ns  58438 ms
       Sporadic 2 budget 030000000 ns  41757 ms
     2 Sporadic 1 budget 010000000 ns  58449 ms (essentially the same as a budget of zero).
       Sporadic 2 budget 030000000 ns  41747 ms
     3 Sporadic 1 budget 020000000 ns  91854 ms
       Sporadic 2 budget 030000000 ns   8352 ms
     4 Sporadic 1 budget 030000000 ns 100208 ms
       Sporadic 2 budget 030000000 ns      0 ms
     5 Sporadic 1 budget 040000000 ns   8451 ms
       Sporadic 2 budget 030000000 ns  91755 ms
     6 Sporadic 1 budget 050000000 ns  58417 ms
       Sporadic 2 budget 030000000 ns  41779 ms
   
   ```
   NOTE:
   1. These values are very consistent from run to run in my current setup but probably differ in other situations.
   
   2. Budget values above 50 MS would exceed the maximum of half of the replenishment interval and would not be expected to work with any accuracy.
   
   3. Although there are some failures, in general it looks better than the values that you reported above.
   
   Each test case is 100,000 MS total.  Expected results:
   
   ```
       BUDGETS                    EXPECTED       ACTUAL  RESULT
   1.  sporadic 1 budget   0% :   >=       0 MS  58438   OK
       sporadic 2 budget  30% :   >=  30,000 MS  41757   OK
   2.  sporadic 1 budget  10% :   >=  10,000 MS  58449   OK
       sporadic 2 budget  30% :   >=  30,000 MS  41747   OK
   3.  sporadic 1 budget  20% :   >=  20,000 MS  91854   OK
       sporadic 2 budget  30% :   >=  30,000 MS   8352   FAIL!!!
   4.  sporadic 1 budget  30% :   >=  30,000 MS 100208   OK (but used ALL of the interval)
       sporadic 2 budget  30% :   >=  30,000 MS      0   FAIL!!!
   5.  sporadic 1 budget  40% :   >=  40,000 MS   8451   FAIL!!!
       sporadic 2 budget  30% :   >=  30,000 MS  91755   OK
   6.  sporadic 1 budget  50% :   >=  50,000 MS  58417   OK
       sporadic 2 budget  30% :   >=  30,000 MS  41779   OK
   
   ```
   I believe that this may be largely an artifact of the identical priorities for the two sporadic threads.  Consider this priority change:
   
   ```
   user_main: Dual sporadic thread test
   Sporadic 1: prio high 180, low 20, repl 100000000 ns
   Sporadic 2: prio high 170, low 30, repl 100000000 ns
     1 Sporadic 1 budget 000000000 ns   8348 ms
       Sporadic 2 budget 030000000 ns  91853 ms
     2 Sporadic 1 budget 010000000 ns  16707 ms
       Sporadic 2 budget 030000000 ns  83495 ms
     3 Sporadic 1 budget 020000000 ns  25064 ms
       Sporadic 2 budget 030000000 ns  75142 ms
     4 Sporadic 1 budget 030000000 ns  33422 ms
       Sporadic 2 budget 030000000 ns  66785 ms
     5 Sporadic 1 budget 040000000 ns  41777 ms
       Sporadic 2 budget 030000000 ns  58429 ms
     6 Sporadic 1 budget 050000000 ns  50125 ms
       Sporadic 2 budget 030000000 ns  50081 ms
   
   
   ```
   Expected results:
   
   ```
       BUDGETS                    EXPECTED       ACTUAL    RESULT
   1.  sporadic 1 budget   0% :   >=       0 MS   8348 MS  OK
       sporadic 2 budget  30% :   >=  30,000 MS  91853 MS  OK
   2.  sporadic 1 budget  10% :   >=  10,000 MS  16707 MS  OK
       sporadic 2 budget  30% :   >=  30,000 MS  83495 MS  OK
   3.  sporadic 1 budget  20% :   >=  20,000 MS  25064 MS  OK
       sporadic 2 budget  30% :   >=  30,000 MS  75142 MS  OK
   4.  sporadic 1 budget  30% :   >=  30,000 MS  33422 MS  OK
       sporadic 2 budget  30% :   >=  30,000 MS  66785 MS  OK
   5.  sporadic 1 budget  40% :   >=  40,000 MS  41777 MS  OK
       sporadic 2 budget  30% :   >=  30,000 MS  58429 MS  OK
   6.  sporadic 1 budget  50% :   >=  50,000 MS  50125 MS  OK
       sporadic 2 budget  30% :   >=  30,000 MS  50081 MS  OK
   
   ```
   The fact that this priority change eliminates the problem still suggests to me that that there is some issue but that just is more subtle than it originally appeared.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org