I have a common problem in C#, I know how can I make the data to be thread-safe but I don't know which method would be best for my case.
My application receives data from serial port ( 10 floats per sample and 100 Samples/s) and I'd like to store that data somehow (heres a question as well, what would be the best idea to keep for example last 2000 samples? a queue of structs? ) and I'd like to access that collection from another thread to draw charts and also another thread that would perform calculations over the received data in real-time.
Should I use a simple lock? or maybe a concurrent collecion? or other?;)