thread safe fat

Hi, I'm using in a project of mine a free FAT filesystem to manage an sd card. Im' using an ATmega64 so I have not too much RAM. I also need to use an OS to manage different tasks and can have File system operation requests from different tasks. Is there any intrinsic free thread safe implementation of FAT or have to manage that on my own using semaphores or other synchronization tools? The problem is that if task1 execs a fileopen, filewrite, fileclose sequence and task2 exec a fopen in the middle of the previous sequence is quite likely that tha internal data buffers of the FAT module become corrupted.

Thanks

Reply to
kmagrin
Loading thread data ...

I designed my DOSFS to be reentrant.

formatting link

Reply to
larwe

It seems to be that in your DOSFS each task executing a filewrite or read has to have at least a block-sized buffer and some file-info structures as FILEINFO. It's to much expensive for my RAM resources: with four tasks I run out of memory.

Thanks

Reply to
kmagrin

The filesystem is designed so that it uses no global RAM. This means that if RAM is plentiful you get thread-safety free by simply using separate RAM structures.

If RAM is in short supply, you can use a single set of RAM structures for an arbitrary number of tasks and provide whatever safing features you require using your own system of semaphores, exactly as you requested in your original post.

Reply to
larwe

The storage device itself still has to be shared. So is the cache, the chain allocation/deallocation algorithms, etc. Anyway there should be either semaphores, or client-server mechanism, or a crude disabling of the task switching.

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.