Dear all,
I am using Keil 5.16 and CMSIS Keil RTX RTOS. I am analysing my design scenario in which I need to share a data structure between two threads created using osThreadCreate(). One thread will be writing to this data structure. Another thread will be reading from this data structure. Reading/writing can happen simultaneously. I understood there are two possibilities.
One option is to maintain a global structure and both threads read/write to this structure by protecting using a mutex.
Another option is to maintain the structure within a memory pool created and both threads read/write to this pool protected using a mutex.
Can anyone tell me which is the effective solution? As all the threads run in the same address space, theoretically I didn't feel any difference if it is a global data structure or is maintained in a pool.. Can you share your thoughts on this?
Thank you, Lullaby Dayal
If you dynamically create thread pairs, then it would be meaningful to dynamically create the buffer they use to share information.