Page 1 of 1

Warning About Multitask Use of EFFS

Posted: Mon Oct 20, 2008 7:16 am
by talexander
I have been using the EFFS for data logging. In a separate task I have a file monitor that FTPs data log files off the board and deletes them when complete. I kept running into file write failures and found after much testing that file operations in one task were interfering with operations in another task. I was able to fix this because I have an abstraction layer for all the file functions and added a critical resource lock around each operation.

Why isn't such a resource lock built into the FFS? The FFS is supposed to be intended for multitask use, but it basically falls apart in this situation and is unstable. The FFS needs a lot more testing than seems to have been done and I hope that the next release will resolve at least this basic issue.

Re: Warning About Multitask Use of EFFS

Posted: Fri Oct 24, 2008 5:50 am
by hendrixj
I can't answer why it is done that way, but I can give a good guess. If you build in the resource lock, you build in extra delay, and those who aren't sharing the device among different threads will pay the same cost as those who are. That would be bad.
This reminds me of file writing in POSIX, you must make a call to lock a file for the thread if you want to make sure other threads aren't going to be doing something to change the file pointers.