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/01 15:24:28 UTC
[GitHub] [incubator-nuttx] JanStaschulat commented on issue #2935: Bug: sporadic scheduling does not work for multiple threads
JanStaschulat commented on issue #2935:
URL: https://github.com/apache/incubator-nuttx/issues/2935#issuecomment-788032529
```
Experimental Results:
Setup:
config:
thread 1:
- SCHED_SPORADIC,
- prio high 180, prio low 20,
- budget 10ms, period 100ms
- max replenishments = 100
thread 2:
- FIFO-thread,
- prio: 120
thread 3:
- SCHED_SPORADIC,
- prio high 179, prio low 19,
- budget 10ms, period 100ms
- max replenishments = 100
-
Hardware:
- Olimex board (STM32),
- NuttX OS
Experiment:
- callback function in each thread has a busy_loop of 1ms and increments a counter
- experiment runs for 10 seconds
- at the end the counter values of all threads are reported, e.g. the number of milliseconds
the thread could execute in interval of 10 seconds (total 10000 milliseconds)
Exp 1: (one sporadic thread and FIFO thread)
configuration with
- thread 1: sporadic thread with budget = x ms and period=100ms
- thread 2: low-prio FIFO thread
config result result
sporadic 1 sporadic 1 fifo
budget(ms) (ms) (ms)
---------------------------------
0 96 9815
10 1074 8837
20 2043 7868
30 3014 6896
40 3985 5925
50 4956 4953
60 5920 3990
70 6899 3010
80 7870 2039
90 8804 1105
100 9910 0
Exp 2 (two sporadic threads and FIFO thread)
Keep sporadic thread 2 with 30/100ms budget/period, vary budget of thread 1 from 0 - 100ms
configuration with
- thread 1: sporadic thread with budget = x ms and period=100ms, prio see above
- thread 3: sporadic thread with budget = 30 ms and period=100ms, prio see above
- thread 2: low-prio FIFO thread, prio see above
config result result result
sporadic 1 sporadic 1 sporadic 2 fifo
budget(ms) (ms) (ms) (ms)
------------------------------------------
0 145 981 8784
10 1073 971 7864
20 2044 10 7854
30 3013 0 6895
40 9909 0 0
50 9909 0 0
60 9909 0 0
70 9909 0 0
80 9908 0 0
90 9908 0 0
100 9909 0 0
Exp 3 (two sporadic threads and FIFO thread)
Keep sporadic thread 1 with 30/100ms budget, vary budget of thread 2 from 0 - 100ms
configuration with
- thread 1: sporadic thread with budget = 30 ms and period=100ms, prio see above
- thread 3: sporadic thread with budget = x ms and period=100ms, prio see above
- thread 2: low-prio FIFO thread, prio see above
config result result result
sporadic 2 sporadic 1 sporadic 2 fifo
budget(ms) (ms) (ms) (ms)
----------------------------------------
0 5246 4661 0
10 7091 2816 0
20 9132 776 0
30 3015 0 6892
40 3016 9 6883
50 3015 49 6844
60 3016 2311 4581
70 3065 2484 4359
80 3015 48 6845
90 3015 91 6802
100 3053 4726 2128
Exp 4 (two sporadic threads and FIFO thread)
Same as Experiment 1, but both sporadic threads with the same priority settings
- sporadic 1: high prio 180, low prio 20
- sporadic 2: high prio 180, low prio 20
- fifo : prio 120
config result result result
sporadic 1 sporadic 1 sporadic 2 fifo
budget(ms) (ms) (ms) (ms)
------------------------------------------
0 144 981 8784
10 1073 971 7864
20 2044 10 7854
30 3015 0 6892
40 39 3044 6825
50 4957 4950 0
60 4427 1559 3923
70 6880 3028 0
80 7840 2066 0
90 8802 1105 0
100 9861 47 0
Example raw output:
Sporadic thread 1: prio high: 180, low: 20, budget: 10000000
pthread_create: budget 0 s 10000000 ns ticks: 10 , period 0 s 100000000 ns ticks 100
thread id 8
sporadic thread 2: at prio high 179 low: 19, budget: 30000000
pthread_create: budget 0 s 30000000 ns ticks: 30 , period 0 s 100000000 ns ticks 100
thread id 9
FIFO thread: prio 120
thread id 10
Result: sporadic 1 1074 ms sporadic 2 19 FIFO 8816 ms
```
Conclustions:
- NuttX works well with one sporadic thread and one fifo thread
- NuttX does not work for
- two sporadic threads and a (backround) fifo thread (varied budget of thread 1 and thread 2)
- two sporadic threads with the same or with different priority settings
- I disagree with the necessity of a third higher prio thread: with sporadic scheduling: if the budget has been depleted, the thread executes with its low priority. That is the work-conserving nature of sched_sporadic: If the processor is idle then a sporadic thread can continue to execute, even though its budget is depleted with its lower priority.
-
----------------------------------------------------------------
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