Reputation: 11
I'm encountering an issue with 3 tasks running on SimulIDE. 2 of them share the same resource. A has priority higher than C (they 2 share the resource), but as soon as C requests the resource, it somehoiw gets preempted by task A while in its critical section.
I'm using a timer:
void do_things(int ms=1){
unsigned long mul = ms * 504UL;
unsigned long i;
for(i=0; i<mul; i++) {
millis();
};
to simulate busy cycles.
I tried changing tick times and changing the order of functions in the code but here's the result:
[taskC_1]
C start: 2799-->
start_do_things_100
end_do_things_100
C:Resource Requested at: 2900
start_do_things_200
end_do_things_200
[taskA_3]
A start: 3102-->
A:Resource Requested at: 3102
A:Resource Released at: 3303
A end:--> 3304
[taskB_2]
B start: 3304-->
[taskA_4]
A start: 3997-->
A:Resource Requested at: 3997
A:Resource Released at: 4198
A end:--> 4199
B end:--> 4208
C:Resource Released at: 4208
C end:--> 4209
as you see, A starts after C has taken the resource
Upvotes: 1
Views: 11