Ive got a thread that writes data to a file, the file write is about 10KB.
Thus in the thread that writes the data it does
open->write->close.
It seems when it does this it consumes the RTOS 100% i.e no other threads are scheduled whilst this is happening.
Ive got the window watchdog running, and this ends up getting reset as thread servicing the watchdog gets starved, it needs to run every 10ms to reload the window watchdog.
If i disable the watchdog i dont get any system resets, but them i dont have the system protection the watchdog gives.
At the moment all threads are running with the same prority, default NORMALPRIO.
PS before anyone asks, using IWDG is not a option, this makes a sleeping system messy.
FatFs hogging the OS
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: FatFs hogging the OS
Hi,
If all threads are at NORMALPRIO then one thread hogging the CPU prevents the others to execute, there is no preemptive round robin, round robin is collaborative and requires threads to yield.
You need to put such threads at a lower priority and, in general, choose appropriate priorities for all threads.
Giovanni
If all threads are at NORMALPRIO then one thread hogging the CPU prevents the others to execute, there is no preemptive round robin, round robin is collaborative and requires threads to yield.
You need to put such threads at a lower priority and, in general, choose appropriate priorities for all threads.
Giovanni
Re: FatFs hogging the OS
whats the thoughts on thread priories and allocating them.....
At the moment most of them are not time critical/low demand and also cooperative thus threads with same priority should just share the CPU in a round robin fashion.
The window watchdog and a time critical sampling thread are the two I've elevated.
But you said you should chose priories for all threads, so whats the best methodology to achieve this. The system at the moment is very stable, as such i dont want to add in at the cost of this.
At the moment most of them are not time critical/low demand and also cooperative thus threads with same priority should just share the CPU in a round robin fashion.
The window watchdog and a time critical sampling thread are the two I've elevated.
But you said you should chose priories for all threads, so whats the best methodology to achieve this. The system at the moment is very stable, as such i dont want to add in at the cost of this.
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: FatFs hogging the OS
A common strategy is to measure the worst case code path for threads then ordering them to have the short paths on top.
Giovanni
Giovanni
Who is online
Users browsing this forum: No registered users and 26 guests